React-native: app crash in release build only

Created on 31 Oct 2018  路  7Comments  路  Source: facebook/react-native

Environment

Environment:
OS: Windows 10
Node: 8.12.0
Yarn: Not Found
npm: 6.4.1
Watchman: Not Found
Xcode: N/A
Android Studio: Version 3.2.0.0 AI-181.5540.7.32.5056338

Packages: (wanted => installed)
react: ^16.5.2 => 16.5.2
react-native: ^0.55.4 => 0.55.4

Description

I have problem with release build of react native. App successfully generated and install in device but crash while open the app.

With android studio LOGCAT I get the log of app and this is the error

018-10-31 23:46:36.803 23221-23239/? D/ReactNative: CatalystInstanceImpl.runJSBundle()

    --------- beginning of crash
2018-10-31 23:46:36.804 23221-23239/? E/AndroidRuntime: FATAL EXCEPTION: Thread-2
    Process: com.myter.parsandishan.parvak, PID: 23221
    java.lang.RuntimeException: Unable to load script from assets 'index.android.bundle'. Make sure your bundle is packaged correctly or you're running a packager server.
        at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
        at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:216)
        at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:31)
        at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:234)
        at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1114)
        at com.facebook.react.ReactInstanceManager.access$900(ReactInstanceManager.java:113)
        at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:911)
        at java.lang.Thread.run(Thread.java:764)

of course in debug build app work correctly with any problem

I searched a lot in previous issue and stackoverflow but any of them wasn't for release build.

Locked

Most helpful comment

@ingviso do this steps in terminal at project root directory
1.(in project directory) mkdir android/app/src/main/assets
2.react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
this produce 2 files that fix the problem. if other files created delete them
for determines other files you can use git.
3.react-native run-android

this fix the problem for me

All 7 comments

It looks like you are using an older version of React Native. Please update to the latest release, v0.57 and verify if the issue still exists.

The ":rewind:Old Version" label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

Was this resolved by updating to latest react-native release ?
Running into same issue with react-native 0.55.2

@ingviso do this steps in terminal at project root directory
1.(in project directory) mkdir android/app/src/main/assets
2.react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
this produce 2 files that fix the problem. if other files created delete them
for determines other files you can use git.
3.react-native run-android

this fix the problem for me

That worked thanks @ProMasoud

@ingviso do this steps in terminal at project root directory
1.(in project directory) mkdir android/app/src/main/assets
2.react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
this produce 2 files that fix the problem. if other files created delete them
for determines other files you can use git.
3.react-native run-android

this fix the problem for me

works for me. thanks

Wow! Been pulling my hair out over this. Why does this work? I inherited a project that doesn't actually have an index.js file so I updated your script to use index.android.js but why does my debug project run with no problem but the signed apk release build crash on startup.

Thanks again!

@ingviso do this steps in terminal at project root directory
1.(in project directory) mkdir android/app/src/main/assets
2.react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
this produce 2 files that fix the problem. if other files created delete them
for determines other files you can use git.
3.react-native run-android

this fix the problem for me

Thanks a million!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anchetaWern picture anchetaWern  路  3Comments

axelg12 picture axelg12  路  3Comments

vikeri picture vikeri  路  3Comments

josev55 picture josev55  路  3Comments

lazywei picture lazywei  路  3Comments