react-native: Unable to load script from assets 'index.android.bundle'.make sure you bundle is packaged correctly.....
Environment: OS: macOS Sierra 10.12.6 Node: 8.3.0 Yarn: 0.27.5 npm: 5.5.1 Watchman: 4.9.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed) react: ^16.3.0-alpha.0 => 16.3.1 react-native: 0.55.0 => 0.55.0
Steps to Reproduce
1:react-native init Test 2:cd Test 3:react-native run-andorid use android virtual genymotion google nexus 6p-7.1.0
Expected Behavior
run normal like ios is ok.
Actual Behavior
if release is ok . can’t load script and can’t debug start chrome.
Unable to load script from assets 'index.android.bundle'.make sure you bundle is packaged correctly.....
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 49 (3 by maintainers)
I have resolved doing this commands:
Hope to help someone 😉
My project runs in debug mode, but the release apk crashes. The logs have the same error ->
Unable to load script from assets 'index.android.bundle'
. What should I do to fix this?The apk was generating fine, until today. I don’t see how I caused it.
@wuyunqiang: can you run
adb reverse tcp:8081 tcp:8081
and try again?I have spent hours trying to figure this issue out.
Accessing the development server worked locally and in the emulator’s browser. The only thing that did not work was accessing the development server in the app.
AndroidManifest.xml
See for more info: https://stackoverflow.com/a/50834600/1713216
this trick “creating assets folder etc” sucks , neither I can not use debugger nor hot reloading …
I have tried ALL the answers here, but none work at all. Including removing build folder, clearing watchman, running as sudo, etc.
Hi guys. I have the same issue. Here’s my logcat output:
ok I run 1:rm -rf /usr/local/var/run/watchman/root-state 2:react-native start 3:will be ok.
@akshaysargar I updated to the latest RN 0.57 with the new metro bundler. then it worked
I have a problem on creating a release build, since today its not building correctly anymore (I dont know why):
:app:bundleReleaseJsAndAssets
successfully creates the index.android.bundle@wuyunqiang: move your issue to stackoverflow because this not a bug report and you will get much more chances of help in there.
Simple as that: https://medium.com/@adityasingh_32512/solved-unable-to-load-script-from-assets-index-android-bundle-bdc5e3a3d5ff
Saved my life!
Yes updated RN to 0.57.5 and finally it worked !!! This issue took me few days to solve it. I was working on RN 0.55.4 initially but was cautiously updating the RN as I had to take care of lot of dependencies. So just to inform, this issue that we are solving occurs on versions 0.56.0, 0.57.0 but finally I updated to the latest version 0.57.5 and that worked. Thanks @phips28, @mtkopone, @rgaraev
I caused this to myself by upgrading the gradle to com.android.tools.build:gradle:3.2.1. And that was because of trying to integrate firebase. Solved by upgrading RN to the latest version.
@phips28 , @km16 did you guys get any solution? My app works fine on physical device when debugging over USB but the release apk crashes. Also this issue appeared for me after doing the react-native-firebase configuration. The major configurations done are in this link below https://rnfirebase.io/docs/v5.x.x/installation/android
@km16 i fixed this. i use android studio ,not eclipse.
assets
dir in android studio isandroid/app/assets
,however, in eclipse isandroid/app/src/main/assets
. So moveindex.android.bundle index.android.bundle.meta
fromandroid/app/src/main/assets
toandroid/app/assets
. it works for me. postIf you work on the Windows, you should run
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
with cmd run as administrator(İmportant). Thus the problem was fixed 😃