react-native run-android
command terminates by leaving a message in android simulator. The message is as follows:
Unable to load script.Make
Try These steps if you have tried everything mentioned in above solutions:
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
If you are on linux open the terminal from the App root directory and run
npm start
then open another terminal window and run:
react-native run-android
I just want to add a non-obvious possibility not covered here. I am using @react-native-community/netinfo for detecting network changes, primarily network state. To test network-off state, the WIFI switch (on the emulator) needs to be switched off. This also effectively cuts off the bridge between the emulator and the debug environment. I had not re-enabled WIFI after my tests since i was away from the computer and promptly forgot about it when i got back.
There is a possibility that this could be the case for somebody else as well and worth checking before taking any other drastic steps.
A similar issue happened with me.
Apparently Mcafee blocks 8081 port. Took me hours to figure this out.
Try running:
react-native run-android --port=1234
When app shows up with an error on emulator, get into dev settings (Ctrl+M).
Change the "Debug server host and port for device" to "localhost:1234".
Close the app and start it from the app drawer.
If you are running on Linux OS,there might be case where your npm remote server is not running. Open another terminal (with project directory) and run this command sudo npm start or sudo react-native start before doing sudo react-native run-android
Apparently, none of the answers fixed the issue for me. I was able to run the react-native app on emulator but the same code (even when the Server was running), gave me this error when running the app on the device.
I was able to resolve it by executing the following command in the terminal:
adb reverse tcp:8081 tcp:8081