0

Currently I have implemented reactnative to existing native app but its directly crashing when i start it from android studio. windows doesnt turns red as usual.

 Process: com.., PID: 15608
    java.lang.RuntimeException: 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.
        at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
corasan
  • 2,636
  • 3
  • 24
  • 41

1 Answers1

1

The problem that you are facing is that a react native project creates a bundle to load the script for the app which you have not created it so your android app is loading nothing when running the react-native run-android command.

Do this in your project root directory:

1- Run this command mkdir android\app\src\main\assets

2- After this command, run 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

Step 2 command execution might take time (have patience)

3- then run react-native run-android command

More info at here and here

HarshitMadhav
  • 4,769
  • 6
  • 36
  • 45