minduch commented on issue #1461: URL: https://github.com/apache/cordova-android/issues/1461#issuecomment-1192269908
I have done some further investigation as to why our project fails performing the `cordova prepare` command when using `[email protected]`. In a new directory, just for testing, I executed the following steps: 1. `cordova create TestApp` 2. `cd TestApp` 3. `cordova platform add android@latest` A new file is generated by the `[email protected]` plugin, namely `platforms\android\app\src\main\res\values\colors.xml` with the contents (originating from `node_modules\cordova-android\templates\project\res\values\colors.xml`): ``` <?xml version='1.0' encoding='utf-8'?> <resources xmlns:tools="http://schemas.android.com/tools"> <color name="cdv_splashscreen_background">#FFFFFF</color> </resources> ``` When looking at our `config.xml` file, there is a block of lines for the (adaptive) icons: ``` <!-- Android adaptive icons with fallback --> <resource-file src="icons/android/adaptive/bgcolor.xml" target="/app/src/main/res/values/colors.xml"/> <!-- Background color - not image --> <!-- Adaptive icons are 108 dp (display pixels) with a "border" of 18 on each side (= 36 reserved by the system), for image size 2048 dp, it gives a bleed of 341.333333333 dp --> <icon src="icons/android/36.png" density="ldpi" foreground="icons/android/adaptive/f48.png" background="@color/background" /> <!-- 36 - 12 (2x 6) - 48 --> <icon src="icons/android/48.png" density="mdpi" foreground="icons/android/adaptive/f64.png" background="@color/background" /> <!-- 48 - 16 (2x 8) - 64 --> <icon src="icons/android/72.png" density="hdpi" foreground="icons/android/adaptive/f96.png" background="@color/background" /> <!-- 72 - 24 (2x12) - 96 --> <icon src="icons/android/96.png" density="xhdpi" foreground="icons/android/adaptive/f128.png" background="@color/background" /> <!-- 96 - 32 (2x16) - 128 --> <icon src="icons/android/144.png" density="xxhdpi" foreground="icons/android/adaptive/f192.png" background="@color/background" /> <!-- 144 - 48 (2x24) - 192 --> <icon src="icons/android/192.png" density="xxxhdpi" foreground="icons/android/adaptive/f256.png" background="@color/background" /> <!-- 192 - 64 (2x32) - 256 --> ``` *When removing the line `<resource-file src="icons/android/adaptive/bgcolor.xml" target="/app/src/main/res/values/colors.xml"/>`, the `cordova prepare` command worked just fine, and the project could then begin to build and the problem was solved.* An interesting thing is however happening when the Android platform is added with our config.xml file, perhaps because we use the plugin `[email protected]` with its `plugins\cordova-plugin-firebasex\src\android\src\android\colors.xml`: ``` <?xml version="1.0" encoding="utf-8"?> <resources> </resources> ``` and the fact that we have some specifications for the splash screen that is now deprecated: ``` <!-- Splash screen --> <preference name="SplashScreen" value="none" /> <preference name="AutoHideSplashScreen" value="false" /> <preference name="ShowSplashScreenSpinner" value="false" /> <preference name="FadeSplashScreen" value="false" /> <preference name="FadeSplashScreenDuration" value="0" /> <!-- 350 --> <preference name="SplashScreenDelay" value="0" /> <!-- 3000 --> <preference name="SplashMaintainAspectRatio" value="true" /> <preference name="SplashShowOnlyFirstTime" value="true" /> <!-- false --> <preference name="SplashScreenBackgroundColor" value="#000000" /> <!-- Black background --> ``` leaves us with the mystery below. Once our Android platform is generated from an existing `config.xml` file (specified in the first entry in this issue) using `cordova platform add android@latest`, the file `platforms\android\app\src\main\res\values\colors.xml` is generated: ``` <?xml version='1.0' encoding='utf-8'?> <resources xmlns:tools="http://schemas.android.com/tools"> <color name="cdv_splashscreen_background">#FFFFFF</color> <color name="accent">#FF00FFFF</color> </resources> ``` For some reason, the XML schema specification `xmlns:tools="http://schemas.android.com/tools"` is added to the `resources` tag along with the `accent` color as `<color name="accent">#FF00FFFF</color>`. We have NO CLUE as to from where the `accent` color definition comes from. **So PLEASE: can Cordova provide better documentation for the Android platform as to regarding the specifics to define the `<color name="cdv_splashscreen_background">#FFFFFF</color>` using some "preference" setting or what not.** Then **how does one add just a new color definition**, in our case the background color for our adaptive icons as the current Cordova documentation example suggests to do, i.e. to specify the icons as we did with a background color: ``` <!-- Android adaptive icons with fallback --> <resource-file src="icons/android/adaptive/bgcolor.xml" target="/app/src/main/res/values/colors.xml"/> <!-- Background color for adaptive icons - not using images --> <!-- Adaptive icons are 108 dp (display pixels) with a "border" of 18 on each side (= 36 reserved by the system), for image size 2048 dp, it gives a bleed of 341.333333333 dp --> <icon src="icons/android/36.png" density="ldpi" foreground="icons/android/adaptive/f48.png" background="@color/background" /> <!-- 36 - 12 (2x 6) - 48 --> <icon src="icons/android/48.png" density="mdpi" foreground="icons/android/adaptive/f64.png" background="@color/background" /> <!-- 48 - 16 (2x 8) - 64 --> <icon src="icons/android/72.png" density="hdpi" foreground="icons/android/adaptive/f96.png" background="@color/background" /> <!-- 72 - 24 (2x12) - 96 --> <icon src="icons/android/96.png" density="xhdpi" foreground="icons/android/adaptive/f128.png" background="@color/background" /> <!-- 96 - 32 (2x16) - 128 --> <icon src="icons/android/144.png" density="xxhdpi" foreground="icons/android/adaptive/f192.png" background="@color/background" /> <!-- 144 - 48 (2x24) - 192 --> <icon src="icons/android/192.png" density="xxxhdpi" foreground="icons/android/adaptive/f256.png" background="@color/background" /> <!-- 192 - 64 (2x32) - 256 --> ``` *In our case, this issue was resolved by either omitting the line `<resource-file src="icons/android/adaptive/bgcolor.xml" target="/app/src/main/res/values/colors.xml"/>`. Then again, in order to get our background colors, the accent color and the cdv_splashscreen_background, we changed our `icons/android/adaptive/bgcolor.xml` file instead of omitting the line that overwrites `colors.xml` to contain:* ``` <?xml version="1.0" encoding="utf-8"?> <resources xmlns:tools="http://schemas.android.com/tools"> <color name="cdv_splashscreen_background">#FFFFFF</color> <color name="accent">#FF00FFFF</color> <color name="background">#664c88</color> </resources> ``` **_After this, the issue was resolved, but we still do not understand how to define these two colors (and perhaps other things), specific to Cordova Android 11+, such as the colors `accent`and `cdv_splashscreen_background`._** -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
