This repository was archived by the owner on May 20, 2025. It is now read-only.
This repository was archived by the owner on May 20, 2025. It is now read-only.
Problem with restartApp() #1684
Closed
Description
Hello, i am having an issue while trying to use codePush.restartApp()
on android, we have no problem on ios but android trigger the following error
Steps to Reproduce
- Add
codePush.restartApp()
on a react-native screen with a setTimeout - Wait for app to crash 🗡
Expected Behavior
App should restart without any problem
Actual Behavior
App crash on release mode, no problem in dev mode
com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets
CatalystInstanceImpl.java, line -2
java.lang.RuntimeException: Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'null' is packaged correctly for release.
Environment
- react-native-code-push version: 5.7.0
- react-native version: 0.60.5
- iOS/Android/Windows version: Android 8.1.0
- Release build, no problem on dev
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
peacepostman commentedon Sep 19, 2019
Note that the issue also happens with or without hermes enabled
KingAmo commentedon Oct 11, 2019
same problem here,
restartApp()
works fine iniOS
anddebug
mode inAndroid
; while inrelease
mode inAndroid
, when callrestartApp()
, app restart successfully but get stuck, and cannot do anything unless you kill app and restart manually ,logcat
info:react-native info
KingAmo commentedon Oct 11, 2019
temporary solution in my case:
peacepostman commentedon Oct 11, 2019
Even with the setTimeout we were encountering this issue, the problem went away when i tried with https://github.com/avishayil/react-native-restart, so even if the linked lib is based upon react-native-code-push, there must something different not causing the issue.
nkashyap commentedon Oct 16, 2019
I tried both workarounds but with no luck :(
aymanblank commentedon Oct 26, 2019
Make sure that you added the following override to your MainApplication.java
inside
private final ReactNativeHost mReactNativeHost
this solved the issue in my case.
andreidubov commentedon Feb 12, 2020
Hi @peacepostman ,
Thank you for reporting!
As I can see, you are using react-native v0.60.5 and react-native-code-push v5.7.0 but these are incompatible versions, you can take a look at supporting CodePush versions here: https://github.com/microsoft/react-native-code-push#supported-react-native-platforms
Not so long ago we released a new version of Code Push which supports react-native v0.60-v0.61.
All steps for installing the latest version of the plugin are described in our documentation: https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md
I'm going to close this issue for now. Please feel free to reopen it if you have any questions or issues.
rafetkhallaf commentedon Mar 18, 2022
Hi there,
I'm facing the same issue on RN 0.66.3 and using the latest codePush 7.0.4. I see in the ReadMe the supported version is v7.2 is there a specific way to upgrade the version from 7.0 to 7.2? I tried hard coding the version but I get an error that it doesn't exists.
Thanks in advance!