-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
App crashing on running updated bundle #1144
Comments
what kind of clarifications can I provide? |
Hi @marcmo, thanks for reaching us. I've added clarification tag by mistake. As for your issue, could you please double check if your app has been configured correctly using this installation guide. Please also take a look at this #790 (comment) - at the end of the comment you can find the configured app that should work. |
thanks for responding @sergey-akhalkov , I checked and my setup is almost exactly the same, only the name I use for my
I had a lot of different issues and was able to resolve them but now what baffles me is that my setup works perfectly fine when running during development, but the error shows up in the installed release version. |
@marcmo, could you please share which way you are registering your callable module?
|
are you sure about the call to CodePush? For me it seems this is how I use codepush:
I have to admit I don't yet understand the RN app lifecycle implications on codepush. e.g. if it is possible/advisable to ask for a codepush sync like this:
|
Yeah, I'm sure, please take a look at
Looks good, it's really weird why CodePush doesn't work for you. Could you please share the minimum working version of you App so I'll be able to take a look at it closer? |
@sergey-akhalkov I will try to prepare a minimal app version but that will take me some time... Module AppRegistry is not a registered callable module (calling runApplication) anyway...thanks for looking into this. I will try to setup a sharable example to demonstrate this behavior. |
Hi @marcmo, got it, will wait for the demo!
Please note, that running RN app in the development mode is not actually the same as running in release mode, please see official docs:
Loading JS bundle via packager is the main reason why you have no issue in debug mode. CodePush uses locally installed JS bundle instead. |
ok..I prepared a repository (android only) that can demonstrate this behavior: |
@marcmo, great, thank you! I'm going to investigate it and let you know if I have any questions or If I'll found the root cause of the issue. |
@ruslan-bikkinin let me know if you need anything else from my side...I'm really stuck on this one |
Hi @marcmo, I was able to reproduce your issue using demo project you sent us. After further investigation I am suspecting that the root of the problem is somewhere in react-native. Actually, when you are using any install modes but Everything works pretty good when you are starting the app from scratch but something goes wrong after restarting the app using this method because probably several context parts aren't cleared completely in case of registering components asynchronously. We have similar issue here. I will prepare a clean demo and ask the As for now, you can switch install mode to |
thanks so much @ruslan-bikkinin and @sergey-akhalkov ! I just verified that using |
Is there any progress on this? |
fwiw I believe I've somewhat nailed down why this is a problem in wix/react-native-navigation#2331 and a hacky "fix", but I'm afraid I don't yet have a solid generalized solution figured out |
The app doesn't crash for me but navigation is broken. These are the logs I get
|
fwiw the PR I submitted that's linked above seems to fix this bug for me... I'm a bit worried about potential race condition but so far I have yet to see one arise. Also I doubt it will be merged since its for V1 and they've said they're not accepting V1 PRs any more, but I wanted to get it out there for others that are having this issue to fork & patch themselves without having to spend the time I did figuring out what was going wrong. |
Destroy navigation activity layouts on catalyst instance destroy addresses #2331 & microsoft/react-native-code-push#1144
exciting news, despite the announcement that V1 is closed for PRs wix actually merged my fix PR, so @sergey-akhalkov (sorry if you're the wrong person to tag) you might be able to close this issue? edit: cc @ruslan-bikkinin |
Hi @ericketts, I am not responsible for codepush stuff anymore, I believe the right person for it is @alexandergoncharov. |
Hi all, Thanks, |
Is there any progress on this? I hope IMMEDIATE option works soon. |
Same error for me... restarting the app with react-native-navigation on Android causes this error. |
Any news about this ? How can we get the IMMEDIATE option working ? |
In my case the problem seemed to be that the The solution that seems to be working well so far was to add a native In code, it's something like this: /* MyNativeUtils.kt */
@ReactMethod
fun restartApp(promise: Promise) {
val activity = currentActivity
val lock = ReentrantLock()
// MainActivity is my root activity extending RNN NavigationActivity
if (activity == null || activity !is MainActivity) {
Log.e(TAG, "activity is " + activity)
} else {
// show the splash screen while we're reloading
SplashScreen.show(activity, true)
val viewsDestroyed = lock.newCondition()
val destroyed = AtomicBoolean(false)
runOnUiThread(Runnable {
activity.navigator.destroyViews()
try {
lock.lock()
destroyed.set(true)
viewsDestroyed.signalAll()
} finally {
lock.unlock()
}
})
try {
lock.lock()
if (!destroyed.get()) {
// waiting for views to be destroyed
viewsDestroyed.await(3, TimeUnit.SECONDS)
// wake up, JS!
promise.resolve(true);
}
} catch (e: InterruptedException) {
Log.w(TAG, "stopped waiting for views to be destroyed, see stack trace")
e.printStackTrace()
promise.resolve(false)
} finally {
lock.unlock()
}
}
} I'm using reentrant locks just because, you can synchronize however you like, of course. On the JS side I have a snackbar with a restart button that calls this onAppRestart: () =>
MyNativeUtils.restartApp().then((ready) => {
if (ready) {
CodePush.restartApp(false);
} else {
MyNativeUtils.toast("couldn't install update");
}
}) The Hope this helps somebody, it was really a pain to debug! |
Hi @nighttiger1990, @JB-CHAUVIN! |
Hi @nighttiger1990, @JB-CHAUVIN! |
My app is using RNN and uses codepush. When running the app with
react-native run-android
everything works and I can update using codepush. But when I install the app, the app crashes after the codepush update.Expected Behavior
same behavior on installed app and app running with local packager
Actual Behavior
What actually happens?
Environment
The text was updated successfully, but these errors were encountered: