Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to load script from assets 'index.android.bundle'. Make sure your bundle is packaged correctly or you're running a packager server

I am having working React Native application having version 0.38.0, when i have tried to upgrade it to 0.45.1 it is showing following error

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.cxxbridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
at com.facebook.react.cxxbridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:198)
at com.facebook.react.cxxbridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:33)
at com.facebook.react.cxxbridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:216)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:994)
at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:109)
at com.facebook.react.ReactInstanceManager$4.run(ReactInstanceManager.java:746)
at java.lang.Thread.run(Thread.java:761)

I have tried following solutions but it didn't work for me

SO: unable to load script from assets index.android.bundle on windows
SO: react native android failed to load JS bundle

like image 253
Ravi Avatar asked Jun 28 '17 06:06

Ravi


People also ask

Is packaged correctly for release?

android. bundle' is packaged correctly for release Error You Need to start npm first before you run react-native run-android so that First of all run this command in root directory of your project: npm start OR react-native start Then Run this command: react-native run-android Now, Your error must be solved.


2 Answers

To resolve Unable to load script from assets index.android.bundle - React Native follow below process :

You have to create dir assets manually in your android project or make Directory by Terminal/CMD enter mkdir android/app/src/main/assets

Go at the created Directory if that is successfully created then

run step 3 Command:

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

you have your missed files in the folder now you can Run your React Native project npm run android.

https://stackoverflow.com/a/53275340/9489285

like image 58
Hemant Sharma Avatar answered Oct 05 '22 22:10

Hemant Sharma


1- Create a new folder => android/app/src/main/assets
2- Run this command =>

 react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res  

This command will create 2 files : index.android.bundle & index.android.bundle.meta

3- run command => react-native run-android

like image 42
f.jafari Avatar answered Oct 05 '22 20:10

f.jafari