Hi guys,
I'm using 1.13.1-beta for android with React Native 0.27.0. It's a full RN app and I'm calling CodePush.sync() in my componentDidMount method.
The app is crashing right after trying to load the new bundle.
Also, when I launch the app again, the new bundle is loaded and everything is fine.
You can find the logs below:
06-30 21:34:49.061 17819 17889 I ReactNativeJS: [CodePush] Checking for update.
06-30 21:34:49.801 17819 17889 I ReactNativeJS: [CodePush] Downloading package.
06-30 21:34:51.061 17819 17889 I ReactNativeJS: [CodePush] Installing update.
06-30 21:34:51.351 17819 17889 I ReactNativeJS: [CodePush] Restarting app
06-30 21:34:51.371 17819 17890 D ReactNative: [CodePush] Loading JS bundle from "/data/user/0/com.deliverycom/files/CodePush/2dc725964774668d1945036011d552f653639f87ff846d19580d42464cb0d5a0/CodePush/index.android.bundle"
06-30 21:34:51.501 17819 17819 E AndroidRuntime: FATAL EXCEPTION: main
06-30 21:34:51.501 17819 17819 E AndroidRuntime: Process: com.deliverycom, PID: 17819
06-30 21:34:51.501 17819 17819 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.app.Activity.getIntent()' on a null object reference
06-30 21:34:51.501 17819 17819 E AndroidRuntime: at com.microsoft.codepush.react.CodePushNativeModule.loadBundleLegacy(CodePushNativeModule.java:84)
06-30 21:34:51.501 17819 17819 E AndroidRuntime: at com.microsoft.codepush.react.CodePushNativeModule.access$100(CodePushNativeModule.java:34)
06-30 21:34:51.501 17819 17819 E AndroidRuntime: at com.microsoft.codepush.react.CodePushNativeModule$1.run(CodePushNativeModule.java:147)
06-30 21:34:51.501 17819 17819 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739)
06-30 21:34:51.501 17819 17819 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
06-30 21:34:51.501 17819 17819 E AndroidRuntime: at android.os.Looper.loop(Looper.java:158)
06-30 21:34:51.501 17819 17819 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7229)
06-30 21:34:51.501 17819 17819 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
06-30 21:34:51.501 17819 17819 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
06-30 21:34:51.501 17819 17819 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Any idea what's going on?
I'm looking into it. It looks like it went into the legacy loadBundle behaviour, which would indicate that some exception happened. And inside there getCurrentActivity() is somehow returning null, which is bizarre.
Does this happen consistently everytime you send out an update?
What is your installMode? ON_NEXT_RESTART or ON_NEXT_RESUME? Perhaps the change to use getCurrentActivity() breaks in the scenario where the app is backgrounded. I will try to dogfood this and send out a fix.
Hey Geoffrey, thanks for looking into this.
It happens every single time I push an update.
Once I launch the app, and there'a a new update available I think it tries
to "hot swap" bundles and it crashes.
About my install mode,is set to ON _NEXT_RESUME,
But I'd like to note that this crash happens with the app running in
foreground.
Launch the app => check updates => download new bundle => restarting app =>
loading new bundle => crash.
Let me know if you need more info.
Thanks!
On Thursday, June 30, 2016, Geoffrey Goh <[email protected] I'm looking into it. It looks like it went into the legacy loadBundle Does this happen consistently everytime you send out an update? โ
behaviour, which would indicate that some exception happened. And inside
there getCurrentActivity() is somehow returning null, which is bizarre.
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/react-native-code-push/issues/408#issuecomment-229836679,
or mute the thread
https://github.com/notifications/unsubscribe/ABMKWuf4PKMD-FMZkG7FzCBnzgwE7CEvks5qRHXIgaJpZM4JCvuz
.
Just a quick update: I've changed the installMode from ON_NEXT_RESUME to ON_NEXT_RESTART and it's working fine.
@brunobar79 Could I ask you a huge favor? We unfortunately haven't been able to repro this, and we think we know how to fix the exception, but I'd love to understand the root cause better, but we're not sure what is going wrong in your app. Could you perform the following:
node_modules/react-native-code-push/android/app/src/main/com/microsoft/codepush/react/CodePushNativeModule.java file (phew that's a long path!)catch statement on line 144e.printStackTrace(); (above the call to loadBundleLegacy).We clearly need to add better logging to our restart logic, since it's unfortunate that we're a little blind to the cause of this issue you're hitting right now. Apologies for this inconvenience, and thanks so much for reaching out!
@brunobar79 Your comment about using ON_NEXT_RESTART vs ON_NEXT_RESUME confirms that the issue is with our "programmatic restart" logic on Android. Thanks for confirming that! We're going to submit a fix that we believe will help with this, but unfortunately, we don't know the exact root cause and can't repro the problem, so any help with diagnosing this would be hugely helpful. Thanks again!
Hey guys, I'm sorry but I won't be in the office until next Tuesday but
I'll add the logs then and I'll update this thread.
I can also confirm that I didn't flag any release as mandatory.
On Fri, Jul 1, 2016 at 2:37 PM, Jonathan Carter [email protected]
wrote:
@brunobar79 https://github.com/brunobar79 Your comment about using
ON_NEXT_RESTART vs ON_NEXT_RESUME confirms that the issue is with our
"programmatic restart" logic on Android. Thanks for confirming that! We're
going to submit a fix that we believe will help with this, but
unfortunately, we don't know the exact root cause and can't repro the
problem, so any help with diagnosing this would be hugely helpful. Thanks
again!โ
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/react-native-code-push/issues/408#issuecomment-230018797,
or mute the thread
https://github.com/notifications/unsubscribe/ABMKWsfvGPLbJv4ZXdNE-Uk9o9AiLZ1yks5qRV5TgaJpZM4JCvuz
.
@brunobar79 Unfortunately, we still haven't been able to repro this, but we may have resolved it with #410. When you get back into the office next week, could you pull the latest bits from this repo and give it a spin? Thanks so much!
Correction, this fix has now been shipped to NPM, so you can just grab the bits from there whenever is convenient. Let us know how it goes!
Hey @brunobar79, just checking in - were you able to resolve your issue with the fix we shipped?
@silhouettes @lostintangent @geof90 Hey guys, sorry for the delay. I just upgraded to 1.13.2-beta and it's working perfectly. Thanks!
๐ฏ ๐ฏ ๐ฏ ๐ฏ ๐ฏ
Awesome!
Most helpful comment
@silhouettes @lostintangent @geof90 Hey guys, sorry for the delay. I just upgraded to 1.13.2-beta and it's working perfectly. Thanks!
๐ฏ ๐ฏ ๐ฏ ๐ฏ ๐ฏ