2

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

  • Please tell us about all stuff your issue like code that makes this error, packages, modules, and other good information to other developers can solving your issue. – nima Mar 20 '19 at 12:34
  • This error can happen for many reasons. – nima Mar 20 '19 at 12:35
  • it says unable to resolve module './index'. the Metro is not getting the index and I can t run on my device. I am using adroid studio to relate my phone to the code – Essia Ben Hamida Mar 20 '19 at 12:38
  • is your metro bundler even running ? – warl0ck Mar 20 '19 at 13:29

1 Answers1

0

I could have posted this as a comment, but it requires few elaboration hence...

  • I tried adding assets folder in projects -> android/app/src/main/ folder

  • checked if my index.js is fine and has all entry fine

import { AppRegistry } from "react-native";
import App from "./App";
import { name as appName } from "./app.json";  
AppRegistry.registerComponent(appName, () => App);
  • ran this 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 i am able to run the application. All this I tried searching SO, and the reference questions are

1) stack overflow reference 1 2) Stack overflow reference 2

Mehavel
  • 585
  • 3
  • 16