Application crash on Android at startup
We are sometimes seeing an exception at startup using CodePush, then configuration is basic and we are just using .sync() to deal with everything at device ready.
This was seen when deploying a new version of the app via VS-TACO after already having an earlier build of the app on the device which had already updated itself successfully via CodePush.
The earlier build used exactly the same plugins and had the same binary version, all the changes were in the '.\www' folder.
This is using CodePush CLI v1.11.0-beta and Cordova CLI 6.0.0
The trace is as follows:
D/AndroidRuntime(13342): Shutting down VM
E/AndroidRuntime(13342): FATAL EXCEPTION: main
E/AndroidRuntime(13342): Process: com.emrgroup.testapp, PID: 13342
E/AndroidRuntime(13342): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.emrgroup.testapp/com.emrgroup.testapp.MainActivity}: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.microsoft.cordova.CodePushPackageMetadata.label' on a null object reference
E/AndroidRuntime(13342): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2808)
E/AndroidRuntime(13342): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2873)
E/AndroidRuntime(13342): at android.app.ActivityThread.access$900(ActivityThread.java:181)
E/AndroidRuntime(13342): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1482)
E/AndroidRuntime(13342): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(13342): at android.os.Looper.loop(Looper.java:145)
E/AndroidRuntime(13342): at android.app.ActivityThread.main(ActivityThread.java:6145)
E/AndroidRuntime(13342): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(13342): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(13342): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
E/AndroidRuntime(13342): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
E/AndroidRuntime(13342): Caused by: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.microsoft.cordova.CodePushPackageMetadata.label' on a null object reference
E/AndroidRuntime(13342): at com.microsoft.cordova.CodePush.handleUnconfirmedInstall(CodePush.java:333)
E/AndroidRuntime(13342): at com.microsoft.cordova.CodePush.onStart(CodePush.java:446)
E/AndroidRuntime(13342): at org.apache.cordova.PluginManager.onStart(PluginManager.java:276)
E/AndroidRuntime(13342): at org.apache.cordova.CordovaWebViewImpl.handleStart(CordovaWebViewImpl.java:462)
E/AndroidRuntime(13342): at org.apache.cordova.CordovaActivity.onStart(CordovaActivity.java:293)
E/AndroidRuntime(13342): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1234)
E/AndroidRuntime(13342): at android.app.Activity.performStart(Activity.java:6412)
E/AndroidRuntime(13342): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2771)
E/AndroidRuntime(13342): ... 10 more
Hi @emrdev, what version of the cordova plugin are you using? Does this repro on the latest version of the cordova plugin?
Hi, according to the package.json it is 1.9.2-beta - though I notice that doesn't match a release?
Also, VS-TACO says 1.9.0-beta
code-push is 1.9.2-beta (we didn't do release notes because it was a small bug fix, we should fix that), how about cordova-plugin-code-push? (Let me know the version you see when you run cordova plugin ls)
ah ok, yes cordova-plugin-code-push is 1.7.1-beta
@emrdev, I see, you are saying that this is happening only when you deploy a new build updating the existing build on the device(during dev). I think I know what the issue is. I will be testing it out and putting out a fix soon. Luckilly, it seems that this is not an issue that will likely to ever happen in a production scenario.
Yes, once in that state it does not recover, each launch is terminated. And also, yes it's a mixed style of deployment, a version of the app went on the device, that version was updated via CodePush then a new build (from the same source) was deployed to the device via the build tools.
I think we are receiving the same crash. We've received over 160 crashes for around 70 users. So it appears that the app will continue to crash for a user once the app is in this state.
This is happening with the 1.7.1-beta version of the plugin.
Let me know if there is any other information I can provide.
Hi Justin, thanks for letting us know. This has been fixed in #128, we will be validating it and making a release hopefully today, if not tomorrow.
@emrdev / @Justin-Credible We just released an update of the plugin to NPM that addresses this issue. Please upgrade to v1.8.0-beta and let us know if you run into any further issues. Apologies for the crash!