Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'index.android.bundle'

Tags:

react-native

Running my project in android studio I get that error, I just installed everything and I followed everything step by step, I'm using genymotion as an emulator, and use react-native start from the root, check port 8081, disable instant run, everything which is the following link

Unable to load script.Make sure you are either running a Metro server or that your bundle 'index.android.bundle' is packaged correctly for release

like image 789
kuater Avatar asked Nov 30 '22 21:11

kuater


2 Answers

First of all make sure you have started the bundler using this command in root directory:

npm start 

or

react-native start

If doesn't work add assets folder manually in the following directory

android/app/src/main/{assets}

After that rename index.android.js to index.js then use the following 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

Now you can create your apk:

react-native run-android
like image 167
Saeed Avatar answered Dec 04 '22 14:12

Saeed


"react-native": "0.64.1",

I've resolved this problem with changing bundleInDebug: true, in project.ext.react in android > app > build.gradle.

project.ext.react = [
bundleInDebug: true,
enableHermes: ***,  
]
like image 21
Mahmonir Bakhtiyari Avatar answered Dec 04 '22 12:12

Mahmonir Bakhtiyari