har-123 opened a new issue, #1832: URL: https://github.com/apache/cordova-android/issues/1832
# Bug Report **Cannot set properties of null (setting 'text')** during cordova prepare android - config.xml not generating plugin features. ## Problem While upgrading a hybrid Cordova project from Cordova Android 13.0.0 to Cordova Android 14.0.1 (with Cordova CLI remaining at 11.0.0), a recurring build error is encountered during the Android preparation phase (cordova prepare android). The error message is as follows: ``` Will prepare platforms. Running "exec:cdvPrepareAndroid" (exec) task Starting UKG-OneApp prePrepare hook. PrePrepare Hook >> Cannot set properties of null (setting 'text') >> Exited with code: 1. >> Error executing child process: Error: Process exited with code 1. Warning: Task "exec:cdvPrepareAndroid" failed. Use --force to continue. ``` The occurrence of the error is inconsistent: 1.)Sometimes it appears immediately after the first plugin’s prepare hook runs. 2.)Other times it occurs after all plugins have been installed. Additionally, the error logs do not provide any stack trace or reference to the exact file or script where the failure occurs. This lack of context makes it difficult to pinpoint whether the issue originates from a plugin, a Cordova lifecycle hook, or the platform tooling itself. Crucially, subsequent inspection reveals that the platforms/android/app/src/main/res/xml/config.xml file is not being generated correctly with all the expected plugin feature tags and preferences that are defined in the project's root config.xml and specified in package.json. This suggests a failure in Cordova's core configuration merging or processing logic. ### What is expected to happen? -Build should generate successfully ## Information **Troubleshooting Steps Taken:** - Reverted Android SDK Versions: Changed android-targetSdkVersion and android-compileSdkVersion in config.xml back to 34 (from 35). The error persisted. - Verified strings.xml: Confirmed that res/values/strings.xml is correctly formed and contains the app_name. - Checked config.xml Integrity: The root config.xml file is well-formed and contains all plugin definitions and preferences. The issue is that these are not being merged/generated correctly into the platform's config.xml. - Disabled Custom Hooks: Temporarily disabled prePrepare.js and postPrepare.js hook entries in config.xml. The error persisted. - Updated cordova-custom-config: Upgraded from 5.1.0 to 5.1.1. The error persisted. - Clean Builds: Performed thorough clean builds (rm -rf platforms, rm -rf node_modules, npm install, cordova platform add [email protected], cordova prepare android) multiple times. - Inspected android.json: Examined platforms/android/android.json after failed builds; it appears to exist but may not be fully representative if the merge process fails early. **Plugins Included (from package.json):** > cordova-android@^14.0.1 > cordova-plugin-add-swift-support@^2.0.2 > cordova-plugin-camera@^6.0.0 > cordova-plugin-file@^8.0.0 > cordova-plugin-file-transfer@^2.0.0 (or the Git URL you are using) > cordova-plugin-dialogs@^2.0.2-dev > cordova-plugin-filepath@^1.5.5 > cordova-plugin-inappbrowser@^5.0.1-dev > cordova-plugin-mediapicker@^1.0.1 > cordova-plugin-printer@^0.8.0 > cordova-plugin-touch-id@^3.3.1 > cordova-plugin-x-socialsharing@^6.0.4 > cordova-plugin-zip@^3.1.0 > cordova-wheel-selector-plugin@^1.0.0 > cordova.plugins.diagnostic@^7.2.1 > phonegap-plugin-barcodescanner@^7.1.2. and many more..... ( Some of these plugins are locally managed in a directory under the project). **Key Suspicion:** The primary suspect is an issue within Cordova CLI 11.0.0 or Cordova Android 14.0.1 itself, or a critical interaction between core Cordova processes (like configuration merging) and one or more plugins (potentially cordova-custom-config, cordova-plugin-file, cordova-plugin-file-transfer, or custom Git/local plugins) that causes the config.xml generation to fail very early, leading to the generic Cannot set properties of null error. ### Environment, Platform, Device **Environment:** - Cordova CLI Version: 11.0.0 - Cordova Android Platform Version: 14.0.1 - Node.js Version: v20.19.3 - npm Version: 10.8.2 - Operating System: macOS 15.5 - Java Development Kit (JDK) Version: Oracle JDK 17 - Android SDK: SDK Tools 35.0.0 ### Version information cdv-gradle-config.xml file : { "MIN_SDK_VERSION": 26, "SDK_VERSION": 35, "COMPILE_SDK_VERSION": 35, "GRADLE_VERSION": "8.13", "MIN_BUILD_TOOLS_VERSION": "35.0.0", "AGP_VERSION": "8.7.3", "KOTLIN_VERSION": "1.9.24", "ANDROIDX_APP_COMPAT_VERSION": "1.7.0", "ANDROIDX_WEBKIT_VERSION": "1.12.1", "ANDROIDX_CORE_SPLASHSCREEN_VERSION": "1.0.1", "GRADLE_PLUGIN_GOOGLE_SERVICES_VERSION": "4.3.15", "IS_GRADLE_PLUGIN_GOOGLE_SERVICES_ENABLED": true, "IS_GRADLE_PLUGIN_KOTLIN_ENABLED": true, "PACKAGE_NAMESPACE": "io.cordova.helloCordova", "JAVA_SOURCE_COMPATIBILITY": 11, "JAVA_TARGET_COMPATIBILITY": 11, "KOTLIN_JVM_TARGET": null } config.xml file : ``` <?xml version='1.0' encoding='utf-8'?> <widget id="com.ukg.oneapp" ios-CFBundleIdentifier=""$(APP_CONFIG_BUNDLE_IDENTIFIER)"" ios-CFBundleVersion="$(CURRENT_PROJECT_VERSION)" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <!--<widget id="com.ukg.oneapp" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">--> <name>OneApp</name> <description>UKG OneApp Shell</description> <content src="index.html" /> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> <allow-intent href="otpauth://*" /> <allow-intent href="tel:*"/> <allow-intent href="sms:*"/> <allow-intent href="mailto:*"/> <allow-intent href="geo:*"/> <allow-navigation href="http://*/*" /> <allow-navigation href="https://*/*" /> <platform name="android"> <allow-intent href="market:*" /> <hook src="platforms/android/hooks/preBuild.js" type="before_build" /> <hook src="platforms/android/hooks/postBuild.js" type="after_build" /> <hook src="platforms/android/hooks/prePrepare.js" type="before_prepare" /> <hook src="platforms/android/hooks/prePrepare.js" type="before_plugin_add" /> <hook src="platforms/android/hooks/postPrepare.js" type="after_prepare" /> <hook src="platforms/android/hooks/postPrepare.js" type="after_plugin_add" /> <custom-preference name="android-manifest/application/@android:allowBackup" value="false" /> <custom-preference name="android-manifest/application/@android:hardwareAccelerated" value="true" /> <custom-preference name="android-manifest/@android:hardwareAccelerated" value="true" /> <preference name="android-minSdkVersion" value="26" /> <preference name="android-targetSdkVersion" value="35" /> <preference name="android-compileSdkVersion" value="35" /> <preference name="StatusBarOverlaysWebView" value="false" /> <preference name="HostName" value="localhost"/> <preference name="Scheme" value="https"/> <preference name="WKPort" value="8210"/> <preference name="SplashScreenDelay" value="1000"/> <preference name="ShowSplashScreenSpinner" value="false"/> <preference name="FadeSplashScreenDuration" value="300"/> <preference name="AutoHideSplashScreen" value="true"/> </platform> <platform name="ios"> <allow-navigation href="app://*" /> <allow-navigation href="about:*" /> <allow-intent href="maps:*"/> <hook src="platforms/ios/hooks/prePrepare.js" type="before_prepare" /> <hook src="platforms/ios/hooks/postPrepare.js" type="after_prepare" /> <preference name="scheme" value="app" /> <preference name="hostname" value="localhost" /> <preference name="deployment-target" value="13.0" /> <preference name="StatusBarOverlaysWebView" value="true" /> <config-file parent="UISupportedInterfaceOrientations~ipad" target="*-Info.plist"> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortraitUpsideDown</string> </array> </config-file> <privacy-manifest> <key>NSPrivacyTracking</key> <false /> <key>NSPrivacyAccessedAPITypes</key> <array> <dict> <key>NSPrivacyAccessedAPIType</key> <string>NSPrivacyAccessedAPICategoryDiskSpace</string> <key>NSPrivacyAccessedAPITypeReasons</key> <array> <string>E174.1</string> </array> </dict> <dict> <key>NSPrivacyAccessedAPIType</key> <string>NSPrivacyAccessedAPICategoryUserDefaults</string> <key>NSPrivacyAccessedAPITypeReasons</key> <array> <string>CA92.1</string> <string>1C8F.1</string> <string>AC6B.1</string> </array> </dict> <dict> <key>NSPrivacyAccessedAPIType</key> <string>NSPrivacyAccessedAPICategoryFileTimestamp</string> <key>NSPrivacyAccessedAPITypeReasons</key> <array> <string>C617.1</string> <string>3B52.1</string> <string>0A2A.1</string> </array> </dict> </array> </privacy-manifest> </platform> <preference name="AppendUserAgent" value="UkgOneApp ukgpromobileapp"/> <preference name="AndroidXEnabled" value="true" /> <preference name="GradlePluginKotlinEnabled" value="true" /> <preference name="GradlePluginKotlinCodeStyle" value="official" /> <preference name="GradlePluginKotlinVersion" value="1.9.24" /> <preference name="GradlePluginGoogleServicesEnabled" value="true" /> <preference name="GradlePluginGoogleServicesVersion" value="4.3.15" /> <preference name="EnableViewportScale" value="false" /> <preference name="GapBetweenPages" value="0" /> <preference name="PageLength" value="0" /> <preference name="PaginationBreakingMode" value="page" /> <preference name="PaginationMode" value="unpaginated" /> <preference name="KeyboardDisplayRequiresUserAction" value="false"/> <preference name="KeyboardResizeMode" value="body"/> <preference name="StatusBarBackgroundColor" value="#000000" /> <preference name="StatusBarStyle" value="lightcontent" /> <preference name="DisallowOverscroll" value="true" /> <preference name="AndroidLaunchMode" value="singleTask" /> <preference name="iosPersistentFileLocation" value="library" /> <preference name="AndroidPersistentFileLocation" value="Internal" /> <preference name="BackupWebStorage" value="local" /> <preference name="Orientation" value="default" /> <preference name="CameraUsesGeolocation" value="false" /> <preference name="AndroidInsecureFileModeEnabled" value="true" /> <preference name="CRIPageLoadPromptInterval" value="0" /> <preference name="CRIInjectFirstFiles" value="www/appInject/appInject.min.js" /> <preference name="cordova.plugins.diagnostic.modules" value="LOCATION CONTACTS CAMERA" /> <plugin name="ukg-dimensions-plugin" spec="1.4.1"> <variable name="ANDROID_CUSTOM_CONTENT_PROVIDER_PERMISSION_NAME" value="com.ukg.oneapp.provider.READ" /> </plugin> </widget> ``` ## Checklist <!-- Please check the boxes by putting an x in the [ ] like so: [x] --> - [ 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]
