I am getting these errors ;
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.
Open up a new tab in the terminal and in your project folder type react-native-start and then go back to the other tab and run your project by typing react-native run-android
By using react-native start you will see the metro bundler starting up and running. If you want to clear the metro cache then type the below in your project directory
react-native start --reset-cache
Related
My react native project is failing to launch in Android Studio. I am running Metro (ran command line 'npx react-native start' in the project root directory) but the below message appears.
I am able to launch the project with no issues using terminal with the command line 'npx react-native run-android'.
Can someone please assist? I would like to run my project using the emulator in Android Studio and not via terminal.
Error when debugging:
E/unknown:ReactNative: Exception in native call
java.lang.RuntimeException: Unable to load script. Make sure you're either running Metro (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)
at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:234)
at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:29)
at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:263)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1293)
at com.facebook.react.ReactInstanceManager.access$1100(ReactInstanceManager.java:131)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1023)
at java.lang.Thread.run(Thread.java:920)
D/CompatibilityChangeReporter: Compat change id reported: 171***; UID 10***; state: ENABLED
I/FA: Tag Manager is not found and thus will not be used
W/unknown:ReconnectingWebSocket: Couldn't connect to "ws://localhost:8081/message...", will silently retry
Steps to run react-native project in Android Studio:
npm start --reset-cache (it will pop-out a terminal for js-bundling).
open project root android folder in android studio.
wait until build project && if you get any error then resolve it.
after successful build project in android studio "Run" your App. (In case you want to use break-points "Debug-Run" your App.).
Done
I ejected an expo project and tried running npm start and npx react-native run-android. The bundler runs and shows this
To reload the app press "r"
To open developer menu press "d"
The app is installed in the emulator, but shows the following error.
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.
The emulator is able to reach the host machine IP address in the browser.
I tried the following solutions.
Run npm start or react-native start in the root directory of your project before react-native run-android
android:usesCleartextTraffic="true"
Changing port
Nothing helped me. What could be the issue?
Picture of hang in terminal
Just getting started with react native. I've gone through the instructions React-Native and have set up my android emulator, got all that stuff good to go.
I used npx react-native init auth to start a project where I hook up some authentication in RN.
Everything was going well until I ran the command react-native run-android and now it just keeps hanging when it gets to "Starting JS server..." and doesn't do anything.
Compile a react-native Android app without using packager:
react-native run-android --no-packager
After, start packager in another terminal session to bundle js:
react-native start
open a new tab in terminal and execute this command
react-native start
it should be starting the js server
I am building a react native app. Yesterday i have ran successfully cd android && ./gradlew bundleRelease. After that, I have tried to run react-native run-android but got this error: Unable to load script. Make sure you're either running a Metro (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
How to make it work again normally in debug mode?
I fixed by changing targetSdkVersion:28 to 26 in build.gradle file
Maybe try to run npm start -- --reset-cache for the Metro Bundler and then in another terminal try to run react-native run-android
I am a starter of React-native tho I am having trouble with debugging. Program is successfully installing apk to emulator but can not render the component. Whenever I double press 'R' (I am on windows) it throws following error
Try:
cd YourProject
react-native run-android
react-native start