Migrate app on Android 11

I need to migrate at Android@11 in order to upload new update on app store.

I removed android platform

ionic cordova platform remove android

I tried to add new android 11 platform

ionic cordova platform add android@11

Using Node 16.13.0

> nvm list

    19.6.1
    18.16.0
    18.14.2
    18.14.1
  * 16.13.0 (Currently using 64-bit executable)
    14.20.0
    14.16.1

I receive this error

(Use `node --trace-deprecation ...` to show where the warning was created)
Using cordova-fetch for cordova-android@11
Failed to fetch platform cordova-android@11
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
CordovaError: Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @ngx-translate/core@14.0.0
npm ERR! Found: @angular/core@12.1.5
npm ERR! node_modules/@angular/core
npm ERR!   peer @angular/core@"12.1.5" from @angular/common@12.1.5
npm ERR!   node_modules/@angular/common
npm ERR!     peer @angular/common@"12.1.5" from @angular/forms@12.1.5
npm ERR!     node_modules/@angular/forms
npm ERR!       peer @angular/forms@">=8.2.7" from @ionic/angular@5.9.4
npm ERR!       node_modules/@ionic/angular
npm ERR!         @ionic/angular@"^5.9.3" from the root project
npm ERR!       1 more (the root project)
npm ERR!     peer @angular/common@"12.1.5" from @angular/platform-browser@12.1.5
npm ERR!     node_modules/@angular/platform-browser
npm ERR!       peer @angular/platform-browser@"12.1.5" from @angular/forms@12.1.5
npm ERR!       node_modules/@angular/forms
npm ERR!         peer @angular/forms@">=8.2.7" from @ionic/angular@5.9.4
npm ERR!         node_modules/@ionic/angular
npm ERR!         1 more (the root project)
npm ERR!       3 more (@angular/platform-browser-dynamic, @angular/router, the root project)
npm ERR!     4 more (@angular/platform-browser-dynamic, @angular/router, ...)
npm ERR!   peer @angular/core@"12.1.5" from @angular/forms@12.1.5
npm ERR!   node_modules/@angular/forms
npm ERR!     peer @angular/forms@">=8.2.7" from @ionic/angular@5.9.4
npm ERR!     node_modules/@ionic/angular
npm ERR!       @ionic/angular@"^5.9.3" from the root project
npm ERR!     @angular/forms@"~12.1.5" from the root project
npm ERR!   6 more (@angular/platform-browser, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@">=13.0.0" from @ngx-translate/core@14.0.0
npm ERR! node_modules/@ngx-translate/core
npm ERR!   peer @ngx-translate/core@">=14.0.0" from @ngx-translate/http-loader@7.0.0
npm ERR!   node_modules/@ngx-translate/http-loader
npm ERR!     @ngx-translate/http-loader@"^7.0.0" from the root project
npm ERR!   @ngx-translate/core@"^14.0.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/core@16.0.2
npm ERR! node_modules/@angular/core
npm ERR!   peer @angular/core@">=13.0.0" from @ngx-translate/core@14.0.0
npm ERR!   node_modules/@ngx-translate/core
npm ERR!     peer @ngx-translate/core@">=14.0.0" from @ngx-translate/http-loader@7.0.0
npm ERR!     node_modules/@ngx-translate/http-loader
npm ERR!       @ngx-translate/http-loader@"^7.0.0" from the root project
npm ERR!     @ngx-translate/core@"^14.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!

How can I solve it?

Please help me.

Thanks

those errors are unrelated to cordova

you have problems in your peer dependencies that you would need to fix first

How can I solve these dependences? On old environment, the app works.

try using @ngx-translate/core version 12 if it exits, as version 14 doesn’t seem to be compatible with angular 12

Add platform ok

ionic cordova platform add android@11

But I receive error during build prod package

ionic cordova build android --prod --release -- -- --packageType=bundle

Error received:

> Configure project :app
FCMPlugin: Support for Gradle v4 or lower is deprecated. Please upgrade to a newer version.
> Task :CordovaLib:compileReleaseRenderscript
The RenderScript APIs are deprecated. They will be removed in Android Gradle plugin 9.0. See the following link for a guide to migrate from RenderScript: https://developer.android.com/guide/topics/renderscript/migrate

> Task :app:mergeReleaseResources FAILED
ERROR:C:\projects\mgdlab\ionic\gemar-app\platforms\android\app\src\main\res\values\themes.xml: Resource and asset merger: Found item Style/Theme.App.SplashScreen more than one time

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> platforms\android\app\src\main\res\values\themes.xml: Error: Found item Style/Theme.App.SplashScreen more than one time

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 5s
7 actionable tasks: 7 executed
Command failed with exit code 1: platforms\android\gradlew :app:bundleRelease -b \platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.

        cordova.cmd build android --release -- --packageType=bundle exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

This is my config.xml

    <platform name="android">
        <preference name="AndroidXEnabled" value="true" />
        <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
            <application android:usesCleartextTraffic="true" />
            <application android:networkSecurityConfig="@xml/network_security_config" />
        </edit-config>
        <config-file parent="/resources" target="app/src/main/res/values/themes.xml">
            <style name="Theme.App.SplashScreen" parent="Theme.SplashScreen">
                <item name="windowSplashScreenBackground">#FFFFFF</item>
                <item name="windowSplashScreenAnimatedIcon">@drawable/notification_icon.png</item>
                <item name="windowSplashScreenBrandingImage">@drawable/notification_icon.png</item>
                <item name="windowSplashScreenIconBackgroundColor">#FFFFFF</item>
                <item name="windowSplashScreenAnimationDuration">1000</item>
                <item name="postSplashScreenTheme">@style/MyTheme</item>
            </style>
        </config-file>
        <resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
        <allow-intent href="market:*" />
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
        <preference name="AndroidWindowSplashScreenAnimatedIcon" value="resources/android/splash/icon2732.png" />
        <preference name="AndroidWindowSplashScreenBackground" value="#FFFFFF" />
        <preference name="AndroidWindowSplashScreenIconBackgroundColor" value="#FFFFFF" />
    </platform>

:frowning: Very frustrated