I was able to reproduce this issue with the CodePushDemoApp below. Running a codePush.restartApp() without any pending updates or anything is throwing a fatal exception, android only. In my app (not demo one provided) I implemented the background ReactInstance implementation stuff and it still is throwing the same exception.
Added a button that calls CodePush.restartApp()
Here is the stack trace:
05-19 07:53:12.988 5735 5735 E AndroidRuntime: com.facebook.jni.CppException: facebook::react::Recoverable: Could not open fileassets://index.android.bundle: No such file or directory
05-19 07:53:12.988 5735 5735 E AndroidRuntime: at com.facebook.react.cxxbridge.CatalystInstanceImpl.jniLoadScriptFromFile(Native Method)
05-19 07:53:12.988 5735 5735 E AndroidRuntime: at com.facebook.react.cxxbridge.CatalystInstanceImpl.loadScriptFromFile(CatalystInstanceImpl.java:208)
05-19 07:53:12.988 5735 5735 E AndroidRuntime: at com.facebook.react.cxxbridge.JSBundleLoader$2.loadScript(JSBundleLoader.java:53)
05-19 07:53:12.988 5735 5735 E AndroidRuntime: at com.facebook.react.cxxbridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:221)
05-19 07:53:12.988 5735 5735 E AndroidRuntime: at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:935)
05-19 07:53:12.988 5735 5735 E AndroidRuntime: at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:104)
05-19 07:53:12.988 5735 5735 E AndroidRuntime: at com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.doInBackground(ReactInstanceManager.java:218)
05-19 07:53:12.988 5735 5735 E AndroidRuntime: at com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.doInBackground(ReactInstanceManager.java:197)
05-19 07:53:12.988 5735 5735 E AndroidRuntime: at android.os.AsyncTask$2.call(AsyncTask.java:295)
05-19 07:53:12.988 5735 5735 E AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
05-19 07:53:12.988 5735 5735 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
05-19 07:53:12.988 5735 5735 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
05-19 07:53:12.988 5735 5735 E AndroidRuntime: at java.lang.Thread.run(Thread.java:818)
(The more info the faster we will be able to address it!)
I believe this this caused by the following lines in CodePushNativeModule.java:
Method[] methods = jsBundleLoaderClass.getDeclaredMethods();
for (Method method : methods) {
if (method.getName().equals("createFileLoader")) {
createFileLoaderMethod = method;
break;
}
}
calling the method createFileLoader in com.facebook.react.cxxbridge > JSBundleLoader.java, but the method that should be called was createAssetLoader instead.
@EwyynTomato - thank you so much for pointing at this, I've created PR that should fix the issue - https://github.com/Microsoft/react-native-code-push/pull/861.
@hzyIO, @EwyynTomato - could you please check to see if this soultion works for you? (from my side I've also tested it with emulator/real device on signed/unsigned apk with fresh install and codepush updates applied).
If you guys have any reason if it can be implemented other ways - please voice your concerns.
@hzyIO, @EwyynTomato - guys, just a friendly ping, do you have a chance to look at this?
No I haven’t yet, will try to get to it today.
On May 31, 2017, at 1:34 AM, Max notifications@github.com wrote:
@hzyIO https://github.com/hzyio, @EwyynTomato https://github.com/ewyyntomato - guys, just a friendly ping, do you have a chance to look at this?
—
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/847#issuecomment-305123367, or mute the thread https://github.com/notifications/unsubscribe-auth/AALva8BvFKAHtFxZANgOIndeCumpzBqDks5r_SYjgaJpZM4Ngo6C.
@hzyIO I'm going to close the issue as I believe the fix is merged in Master, please test it when you have time and provide us with your feedback. For sure reopen the issue if you see any problems with this.
@max-mironov Sounds good. I do plan on testing this, will comment again if I have an issue.
I got issue like
com.facebook.jni.CppException: facebook::react::Recoverable: Could not open file/data/data/.../CodePush/index.android.bundle: No such file or directory
is it related? Also crashing when new updates coming
Latest version of code push
RN 0.44.00
Thanks
@hose314 thanks for letting us know, that looks interesting.
Is it possible for you to provide us with an example of how we can replicate this issue so we can investigate it? Or even better if you could reproduce it with our sample app?
@max-mironov yeap, i'll try, need some time to configure app with deps.
And yeah, is it's strange that file path looks like shown above (i.e file/... not like file:///)?
@max-mironov Do you have any solution?
same with @hose314
Hi @hslls, got it. Could you please confirm that your issue is not the same as this one which we are currently investigating?
have same problem +1
react-native-code-push version: v1.17.4-beta
react-native-version: 0.37.0
Hey @hose314. I've got the same issue.
Have you change CodePush's bulld.gradle ? I've changed it tocompileSdkVersion 25 and buildToolsVersion "25.0.0". I'm not sure if it can make this crash.
Thanks.
Hi, @youngcube!
Yeap, i've change them due to the react-native-navigation by wix
compileSdkVersion 25
buildToolsVersion '25.0.2'
@hose314 Thanks for this information!
@max-mironov Hope it can help.I've also made another issue to this kind of crash in #918 .
Most helpful comment
I got issue like
is it related? Also crashing when new updates coming
Latest version of code push
RN 0.44.00
Thanks