Cannot read property 'find' of null - Cordova 11
See original GitHub issueBug Report
Problem
Using Cordova 11 to target Android 12 fails to build.
What is expected to happen?
The app should compile.
What does actually happen?
Build crashes during the platform add android@11 with the following error:
Cannot read property 'find' of null
TypeError: Cannot read property 'find' of null
at C:\Jenkins\workspace\REDACTEDPROJECTNAME\node_modules\cordova-android\lib\prepare.js:387:49
at Array.forEach (<anonymous>)
at updateProjectSplashScreen (C:\Jenkins\workspace\REDACTEDPROJECTNAME\node_modules\cordova-android\lib\prepare.js:384:7)
at updateProjectAccordingTo (C:\Jenkins\workspace\REDACTEDPROJECTNAME\node_modules\cordova-android\lib\prepare.js:269:5)
at C:\Jenkins\workspace\REDACTEDPROJECTNAME\node_modules\cordova-android\lib\prepare.js:67:21
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Promise.all (index 0)
[ERROR] An error occurred while running subprocess cordova.
cordova platform add android@11 --verbose --save exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
Information
config.xml:
<widget id="com.COMPANY.CLIENTNAMEmobiledev" version="0.6.0" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>CLIENTNAME-DEV</name>
<description>CLIENTNAME-DEV</description>
<author email="COMPANY@COMPANY.com" href="https://www.COMPANY.com/">COMPANY</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="AndroidXEnabled" value="true" />
<preference name="android-minSdkVersion" value="23" />
<preference name="android-targetSdkVersion" value="32" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="KeyboardResizeMode" value="ionic" />
<hook src="hooks/after_prepare.js" type="after_prepare"/>
<platform name="android">
<resource-file src="firebase-services-dev.json" target="app/google-services.json" />
<resource-file src="www/icon.png" target="app/src/main/res/drawable/icon.png" />
<allow-intent href="market:*" />
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application/activity">
<activity android:windowSoftInputMode="adjustPan" android:exported="true" />
</edit-config>
<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/drawable-port-xxxhdpi-screen.png" />
</platform>
<plugin name="cordova-plugin-camera" spec="^4.0.2" />
<plugin name="cordova-plugin-filechooser" spec="^1.0.1" />
<plugin name="com-badrit-base64" spec="^0.2.0" />
<plugin name="com.telerik.plugins.nativepagetransitions" spec="^0.6.5" />
<plugin name="cordova-plugin-filepath" spec="^1.2.0" />
<plugin name="cordova-plugin-document-viewer" spec="^0.9.9" />
<plugin name="cordova-plugin-datepicker" spec="^0.9.3" />
<plugin name="cordova-plugin-file-opener2" spec="^2.0.19" />
<plugin name="cordova-plugin-x-socialsharing" spec="^5.4.0" />
<plugin name="cordova-plugin-actionsheet" spec="^2.3.3" />
<plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
<plugin name="cordova-plugin-screen-orientation" spec="^3.0.1" />
<plugin name="mx.ferreyra.callnumber" spec="~0.0.2" />
<plugin name="cordova-plugin-email-composer" spec="^0.8.15" />
<plugin name="cordova-plugin-ionic-webview" spec="^4.0.1">
<variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" />
</plugin>
<plugin name="cordova-plugin-ionic-webview" spec="4.0.1">
<variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" />
</plugin>
<plugin name="cordova-plugin-keychain-touch-id" spec="3.2.1" />
<preference name="GOOGLE_MAPS_ANDROID_API_KEY" value="REDACTED" />
<preference name="GOOGLE_MAPS_IOS_API_KEY" value="REDACTED" />
<plugin name="cordova-plugin-file" spec="6.0.2" />
<plugin name="cordova-plugin-filepicker" spec="^1.1.6" />
</widget>
Command or Code
cordova platform add android@11 --verbose
Environment, Platform, Device
Building an Ionic 3.9 app on Windows for Android 12 with Cordova 11.
Version information
` Cordova Packages:
cli: 11.0.0
common: 4.0.2
create: 4.0.0
lib: 11.0.0
common: 4.0.2
fetch: 3.0.1
serve: 4.0.0
`
` Environment:
OS: Microsoft Windows 10 Business 10.0.19042 (19042) (Windows 10.0.19042) x64
Node: v14.18.1
npm: 6.14.15
`
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Cannot read property 'find' of null with cordova-android 11 in ...
The problem seems to have been occurred with one of the plugins. I have faced this problem many a times, hence I always...
Read more >TypeError: Cannot read property 'find' of null #2623 - GitHub
try to run the app on device with the following command: ionic cordova run ios --device --livereload ...
Read more >Migrating to Cordova-Android 11 - Ionic
Cannot Set Properties of null This may occur because version 32 is the specific version required with Cordova-Android 11. It may occur even...
Read more >Error running npm/ionic commands - Cannot read property ...
I'm building an app in Ionic using Angular/Firebase. I want to test the app on my android device, which, previously has worked perfectly....
Read more >Cordova Android 11.0.0 Released!
We are happy to announce that we have just released Cordova Android 11.0.0! This is one of Cordova's supported platforms for building ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had the same error and detected it was due to a plugin saving a themes.xml file to the res folder. I changed the plugin to save the file as themesother.xml and then I could add the android@11 platform ok.
thx