Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'find' of null - Cordova 11 #1479

Closed
3 tasks done
ATaysikuu opened this issue Aug 29, 2022 · 5 comments
Closed
3 tasks done

Cannot read property 'find' of null - Cordova 11 #1479

ATaysikuu opened this issue Aug 29, 2022 · 5 comments
Labels
info-needed / awaiting response Further information is requested

Comments

@ATaysikuu
Copy link

ATaysikuu commented Aug 29, 2022

Bug 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
@jcesarmobile
Copy link
Member

I can't reproduce with the provided config.xml, can you provide a full app reproducing the issue?

@jcesarmobile jcesarmobile added the info-needed / awaiting response Further information is requested label Aug 31, 2022
@jcesarmobile
Copy link
Member

Closing since there was no response and I can’t reproduce

@jcesarmobile jcesarmobile closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2022
@mchenx
Copy link

mchenx commented Oct 22, 2022

I am having the same error, here is the error generated with '--verbose'

When upgrade cordova from 8.0 to 11.0 in a ionic 3.9.2 project, I was using cordova-plugin-splashscreen plugin, and now I have removed it from the project by run 'ionic cordova plugin rm cordova-plugin-splashscreen' and cleared tags from config.xml file.

Does this look similar to #1441 ?

Actually this could be solved according this official doc https://cordova.apache.org/docs/en/latest/core/features/splashscreen/index.html#android-specific-information


Cannot read property 'find' of null
TypeError: Cannot read property 'find' of null
    at forEach.themeKey (C:\Users\mmcent\projects\app\dev-2.6.3\node_modules\cordova-android\lib\prepare.js:387:49)
    at Array.forEach (<anonymous>)
    at updateProjectSplashScreen (C:\Users\mmcent\projects\app\dev-2.6.3\node_modules\cordova-android\lib\prepare.js:384:7)
    at updateProjectAccordingTo (C:\Users\mmcent\projects\app\dev-2.6.3\node_modules\cordova-android\lib\prepare.js:269:5)
    at Promise.resolve.then.then (C:\Users\mmcent\projects\app\dev-2.6.3\node_modules\cordova-android\lib\prepare.js:67:21)
    at process._tickCallback (internal/process/next_tick.js:68:7)
[ERROR] An error occurred while running subprocess cordova.

        cordova.cmd platform add android@11.0.0 --verbose exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
  ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms
  ionic:utils-process onBeforeExit handler: running 1 functions +0ms
  ionic:utils-process error while killing process tree for 38948: { Error: Command failed: taskkill /pid 38948 /T /F
  ionic:utils-process ERROR: The process "38948" not found.
  ionic:utils-process
  ionic:utils-process     at ChildProcess.exithandler (child_process.js:294:12)
  ionic:utils-process     at ChildProcess.emit (events.js:198:13)
  ionic:utils-process     at maybeClose (internal/child_process.js:982:16)
  ionic:utils-process     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
  ionic:utils-process   killed: false,
  ionic:utils-process   code: 128,
  ionic:utils-process   signal: null,
  ionic:utils-process   cmd: 'taskkill /pid 38948 /T /F' } +451ms
  ionic:utils-process onBeforeExit handler: error from function: { Error: Command failed: taskkill /pid 38948 /T /F
  ionic:utils-process ERROR: The process "38948" not found.
  ionic:utils-process
  ionic:utils-process     at ChildProcess.exithandler (child_process.js:294:12)
  ionic:utils-process     at ChildProcess.emit (events.js:198:13)
  ionic:utils-process     at maybeClose (internal/child_process.js:982:16)
  ionic:utils-process     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
  ionic:utils-process   killed: false,
  ionic:utils-process   code: 128,
  ionic:utils-process   signal: null,
  ionic:utils-process   cmd: 'taskkill /pid 38948 /T /F' } +8ms
  ionic:utils-process processExit: exiting (exit code: 1) +14ms```

@veronicatc
Copy link

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.

@jhonnathanH
Copy link

thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed / awaiting response Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants