minduch opened a new issue, #1461:
URL: https://github.com/apache/cordova-android/issues/1461
# Bug Report
Using Cordova 11 and Android 11.0.0, the `cordova prepare android --debug`
command fails with:
```
The "AndroidWindowSplashScreenAnimatedIcon" is undefined. Cordova's default
will be used.
Cannot set properties of null (setting 'text')
TypeError: Cannot set properties of null (setting 'text')
at updateProjectSplashScreenBackgroundColor
(C:\iizi\iiziRunDevel\node_modules\cordova-android\lib\prepare.js:484:68)
at
C:\iizi\iiziRunDevel\node_modules\cordova-android\lib\prepare.js:392:13
at Array.forEach (<anonymous>)
at updateProjectSplashScreen
(C:\iizi\iiziRunDevel\node_modules\cordova-android\lib\prepare.js:384:7)
at updateProjectAccordingTo
(C:\iizi\iiziRunDevel\node_modules\cordova-android\lib\prepare.js:269:5)
at C:\iizi\iiziRunDevel\node_modules\cordova-android\lib\prepare.js:67:21
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Promise.all (index 0)
```
## Problem
We do not want to display a splash screen at all, and the only way to do so
is to include the `cordova-plugin-spashscreen` and then turn it off using
`<preference name="SplashScreen" value="none"/>`. Please note that we don't
provide any splash screen assets.
### What is expected to happen?
The production of the prepared Android Cordova build.
When using Cordova Android 10.1.2 it worked fine.
### What does actually happen?
Cordova Prepare fails with the verbose output:
```
Wrote out android application name "Develop" to
C:\iizi\iiziRunDevel\platforms\android\app\src\main\res\values\strings.xml
The "AndroidWindowSplashScreenAnimatedIcon" is undefined. Cordova's default
will be used.
Cannot set properties of null (setting 'text')
TypeError: Cannot set properties of null (setting 'text')
at updateProjectSplashScreenBackgroundColor
(C:\iizi\iiziRunDevel\node_modules\cordova-android\lib\prepare.js:484:68)
at
C:\iizi\iiziRunDevel\node_modules\cordova-android\lib\prepare.js:392:13
at Array.forEach (<anonymous>)
at updateProjectSplashScreen
(C:\iizi\iiziRunDevel\node_modules\cordova-android\lib\prepare.js:384:7)
at updateProjectAccordingTo
(C:\iizi\iiziRunDevel\node_modules\cordova-android\lib\prepare.js:269:5)
at C:\iizi\iiziRunDevel\node_modules\cordova-android\lib\prepare.js:67:21
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Promise.all (index 0)
```
## Information
The config.xml file:
```
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
version = "1.0.0"
android-versionCode = "10000"
defaultlocale = "en-US"
id = "com.some.prod"
android-packageName = "com.some.prod">
<name>Product Name</name>
<description>Description</description>
<author email="[email protected]" href="https://somewhere.com">Some Company
Name</author>
<!-- "~11.0.0" fails, but "10.1.2" is working-->
<engine name="android" spec="11.0.0" />
<plugin name="cordova-plugin-proguard" spec="~2.2.0" />
<preference name="PreferredContentMode" value="mobile" />
<preference name="AndroidPersistentFileLocation" value="Internal"/>
<preference name="AndroidXEnabled" value="true" />
<preference name="android-minSdkVersion" value="22" />
<preference name="android-targetSdkVersion" value="33" />
<config-file target="config.xml" parent="/*">
<preference name="GradlePluginGoogleServicesEnabled" value="true" />
</config-file>
<plugin name="cordova-plugin-splashscreen" spec="~6.0.2" />
<plugin name="cordova-plugin-battery-status" spec="~2.0.3" />
<plugin name="cordova-plugin-network-information" spec="~3.0.0" />
<plugin name="cordova-plugin-statusbar" spec="~3.0.0" />
<plugin name="cordova-plugin-vibration" spec="~3.1.1" />
<plugin name="cordova-plugin-file" spec="~7.0.0" />
<plugin name="cordova-plugin-camera" spec="~6.0.0" />
<plugin name="cordova-plugin-device" spec="~2.1.0" />
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />
</feature>
<plugin name="cordova-plugin-dialogs" spec="~2.0.2" />
<plugin name="cordova-plugin-geolocation" spec="~4.1.0" />
<plugin name="cordova-plugin-inappbrowser" spec="~5.0.0" />
<plugin name="cordova-plugin-media" spec="~6.0.0">
<variable name="KEEP_AVAUDIOSESSION_ALWAYS_ACTIVE" value="YES" />
</plugin>
<plugin name="cordova-plugin-media-capture" spec="~4.0.0"
/>
<plugin name="cordova-plugin-screen-orientation" spec="~3.0.2" />
<plugin name="cordova-plugin-customurlscheme" spec="~5.0.2" >
<variable name="URL_SCHEME" value="iizirundev"
/>
</plugin>
<plugin name="cordova-plugin-fingerprint-aio" spec="~5.0.1">
<variable name="FACEID_USAGE_DESCRIPTION" value="For Face ID
authentication" />
</plugin>
<plugin name="phonegap-plugin-barcodescanner" spec="~8.1.0">
<variable name="ANDROID_SUPPORT_V4_VERSION" value="24.1.0" />
</plugin>
<plugin name="wifiwizard2" spec="~3.1.1" />
<plugin name="cordova-plugin-flashlight" spec="~3.2.0" />
<plugin name="cordova-plugin-firebasex" spec="~14.1.0" >
<variable name="FIREBASE_ANALYTICS_COLLECTION_ENABLED" value="true" />
<variable name="FIREBASE_PERFORMANCE_COLLECTION_ENABLED" value="true" />
<variable name="FIREBASE_CRASHLYTICS_COLLECTION_ENABLED" value="true" />
<variable name="IOS_ENABLE_CRITICAL_ALERTS_ENABLED" value="false" />
</plugin>
<allow-intent href="iizirundev:*" />
<allow-intent href="http:*" />
<allow-intent href="https:*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-intent href="maps:*" />
<allow-intent href="comgooglemaps:*" />
<allow-intent href="facetime:*" />
<allow-intent href="fb:*" />
<allow-intent href="whatsapp:*" />
<allow-intent href="twitter:*" />
<allow-intent href="pinterest:*" />
<allow-intent href="instagram:*" />
<allow-intent href="vnd.youtube:*" />
<allow-intent href="yelp:*" />
<allow-intent href="linkedin:*" />
<allow-intent href="snapchat:*" />
<allow-intent href="tumblr:*" />
<access origin="*" />
<access origin="cdvfile://*" />
<access origin="https://tel:*" launch-external="yes" />
<access origin="https://sms:*" launch-external="yes" />
<access origin="https://mailto:*" launch-external="yes" />
<access origin="https://geo:*" launch-external="yes" />
<access origin="https://facetime:*" launch-external="yes" />
<access origin="https://maps:*" launch-external="yes" />
<access origin="https://comgooglemaps:*" launch-external="yes" />
<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 -->
<preference name="DisallowOverscroll" value="true" />
<preference name="KeyboardDisplayRequiresUserAction" value="false" />
<preference name="SuppressesLongPressGesture" value="true" />
<preference name="Suppresses3DTouchGesture" value="true" />
<preference name="CameraUsesGeolocation" value="true" />
<platform name="android">
<content src="http://localhost/index.html" />
<allow-intent href="market:*" />
<preference
name="android-manifest/application/activity/@android:windowSoftInputMode"
value="adjustPan" />
<config-file target="AndroidManifest.xml" parent="./application"
mode="replace">
<meta-data android:name="android.max_aspect" android:value="5.0"/>
</config-file>
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge"
target="/manifest/application">
<application android:usesCleartextTraffic="true" />
</edit-config>
<icon src="icons/android/96.png" />
<resource-file src="icons/android/adaptive/bgcolor.xml"
target="/app/src/main/res/values/colors.xml"/>
<icon src="icons/android/36.png" density="ldpi"
foreground="icons/android/adaptive/f48.png" background="@color/background" />
<icon src="icons/android/48.png" density="mdpi"
foreground="icons/android/adaptive/f64.png" background="@color/background" />
<icon src="icons/android/72.png" density="hdpi"
foreground="icons/android/adaptive/f96.png" background="@color/background" />
<icon src="icons/android/96.png" density="xhdpi"
foreground="icons/android/adaptive/f128.png" background="@color/background" />
<icon src="icons/android/144.png" density="xxhdpi"
foreground="icons/android/adaptive/f192.png" background="@color/background" />
<icon src="icons/android/192.png" density="xxxhdpi"
foreground="icons/android/adaptive/f256.png" background="@color/background" />
</platform>
</widget>
```
The part with all the icons could probably be left out for testing.
As you can see, there are no provided spash screens.
Source code of
`C:\iizi\iiziRunDevel\node_modules\cordova-android\lib\prepare.js:484:68`:
```
/**
* @param {String} splashBackgroundColor SplashScreen Background Color
Hex Code
* be used to update project
* @param {Object} locations A map of locations for this platform
*/
function updateProjectSplashScreenBackgroundColor (splashBackgroundColor,
locations) {
if (!splashBackgroundColor) { splashBackgroundColor = '#FFFFFF'; }
// res/values/colors.xml
const colors = xmlHelpers.parseElementtreeSync(locations.colors);
/* Line 484 */
colors.find('color[@name="cdv_splashscreen_background"]').text =
splashBackgroundColor.replace(/'/g, '\\\'');
fs.writeFileSync(locations.colors, colors.write({ indent: 4 }), 'utf-8');
events.emit('verbose', 'Wrote out Android application SplashScreen Color
to ' + locations.colors);
}
```
If I edit the source code to include the following line before line 484:
```
if ( colors.find('color[@name="cdv_splashscreen_background"]') )
```
The prepare command works a little bit longer but fails as show below, and I
don't know the side-effects.
```
Checking Java JDK and Android SDK versions
ANDROID_HOME=C:\iiziBuildInstall\windows\android (recommended setting)
ANDROID_SDK_ROOT=C:\iiziBuildInstall\windows\android (DEPRECATED)
Using Android SDK: C:\iiziBuildInstall\windows\android
Reading build config file: C:\iizi\iiziRunDevel\build.json
Reading the keystore from: C:\iizi\iiziRunDevel\nexum.keystore
Starting a Gradle Daemon (subsequent builds will be faster)
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 SUCCESSFUL in 15s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
Gradle Distribution URL:
https://services.gradle.org/distributions/gradle-7.4.2-all.zip
FAILURE: Build failed with an exception.
* Where:
Script 'C:\iizi\iiziRunDevel\platforms\android\CordovaLib\cordova.gradle'
line: 165
* What went wrong:
A problem occurred evaluating script.
> For input string: "android-33"
* 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 1s
Command failed with exit code 1:
C:\iizi\iiziRunDevel\platforms\android\gradlew cdvBuildDebug -b
C:\iizi\iiziRunDevel\platforms\android\build.gradle
Error: Command failed with exit code 1:
C:\iizi\iiziRunDevel\platforms\android\gradlew cdvBuildDebug -b
C:\iizi\iiziRunDevel\platforms\android\build.gradle
at makeError (C:\iizi\iiziRunDevel\node_modules\execa\lib\error.js:60:11)
at handlePromise
(C:\iizi\iiziRunDevel\node_modules\execa\index.js:118:26)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ProjectBuilder.build
(C:\iizi\iiziRunDevel\node_modules\cordova-android\lib\builders\ProjectBuilder.js:330:20)
```
### Command or Code
`cordova prepare android --debug`
### Environment, Platform, Device
Windows 11, Node v16.16.0, Cordova 11.0.0, Android 11.0.0.
### Version information
```
npm info cordova
[email protected] | Apache-2.0 | deps: 13 | versions: 1887
Cordova command line interface tool
keywords: cordova, client, cli
bin: cordova
dist
.tarball: https://registry.npmjs.org/cordova/-/cordova-11.0.0.tgz
.shasum: c7a4bf853a55652aa293d20299a6c92ba3a22af1
.integrity:
sha512-Hu2YeT0naeP/1sEm/xfJYUsXN48XV6zagxbi1+4q0Ei9c5TKsIq8v4EWukvSHF4UO2pnh+9ViaDlGMcS1Wrnfg==
.unpackedSize: 144.3 kB
dependencies:
configstore: ^5.0.1 editor: ^1.0.0 loud-rejection: ^2.2.0
update-notifier: ^5.1.0
cordova-common: ^4.0.2 execa: ^5.1.1 nopt: ^5.0.0
cordova-create: ^4.0.0 fs-extra: ^10.0.0 semver: ^7.3.5
cordova-lib: ^11.0.0 insight: ^0.11.1 systeminformation:
^5.9.17
dist-tags:
3.6.0-0.2.8: 3.6.0-0.2.8 nightly:
11.0.1-nightly.2022.7.18.6cf1e36c
latest: 11.0.0 rc: 5.3.3
```
## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
--
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]