Crash while restarting app after downloading new bundle
App downloads updated bundle from server. But when tries to restart the app, it crashes. With lot of Sync already in progress. and Loading bundle on resume messages.
ReactNativeJS: [CodePush] Downloading package.
ReactNativeJS: [CodePush] Installing update.
ReactNativeJS: [CodePush] Restarting app
ReactNative: [CodePush] Loading bundle on resume
ReactNativeJS: [CodePush] Sync already in progress.
ReactNative: [CodePush] Loading bundle on resume
ReactNativeJS: [CodePush] Sync already in progress.
ReactNative: [CodePush] Loading bundle on resume
...
<Continues for few seconds>
crash log says
com.facebook.react.uimanager.IllegalViewOperationException: Trying to add unknown view tag: 4040
Update is complete as expected, when app is ran after crash.
Any pointers to debug this issue?
Hi @thotegowda, thanks for reaching us, could you please take a look at https://github.com/Microsoft/react-native-code-push/issues/841 and verify if you have the same issue as there or not?
Thanks @sergey-akhalkov for quick response. Its the same issue, but the work-around mentioned in the thread, i.e. dex-guard configuration, is not working.
Its happening even in the debug build, where dex-guard is disabled.
@thotegowda, got it, thanks for the clarification. I've not seen such kind of issue before, so could you please create new issue in react-native-code-push repo and fill as much info as possible? Also could you please try to reproduce the issue using our sample app/try to debug existing one from this point or share with us source code (minimal version of the app where the issue reproduces) if available?
Please let me know if you have any questions.
Hey @sergey-akhalkov, spent some time looking in to what is happening. CodePushNativeModule.java looks in two ways to resolve ReactInstanceManager instance. (1) method getReactNativeHost() of ReactApplication (2) mReactInstanceManager member in ReactActivity or its derived.
In our case it was failing because we had a static instance of ReactNativeHost (our's is a brownfield application and also have our own reasons for keeping it as a static instance). For time being, I have fixed this issue by deriving Application class with ReactApplication and return static instance of the ReactNativeHost.
I think, we need a better approach for fetching ReactInstanceManager instance. Seen few discussions and PRs around this in react-native-code-push. So closing the issue.
Thank you
Hey @thotegowda, got it, thanks for the clarification, please let us know if you see any issues or have any questions.