Fix "Unable to load script" (index.android.bundle) in React Native
Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
- Unable to load script from assets 'index.android.bundle'. Make sure your bundle is packaged correctly or you're running a packager server.
- Could not connect to development server.
- No bundle URL present. Make sure you're running a packager server or have included a .jsbundle file in your application bundle.
- 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 app found neither a reachable Metro server nor an embedded JavaScript bundle. In development, run npx react-native start, then adb reverse tcp:8081 tcp:8081 if you use a physical device; in release, make sure the bundle is generated into the APK.
What this error means
A React Native app is a native shell that runs a JavaScript bundle. In a debug build, it downloads that bundle from Metro, the development server, at localhost:8081 (as seen from the device). In a release build, the index.android.bundle file is compiled and copied into the APK assets. This red screen appears when neither source is available: Metro is not running, the device cannot reach your computer, or a release build was produced without a bundle. On iOS, the same problem shows "No bundle URL present".
Common causes
- Metro is not running or crashed (port 8081 already in use, syntax error at startup).
- Physical device cannot see Metro: over USB,
localhostmeans the phone, not your computer, untiladb reverseis set up; over Wi-Fi, the IP is not configured or a firewall blocks the port. - Release build without a bundle: APK built while skipping the bundle task, or a custom build variant the React Native Gradle plugin does not handle.
- Cleartext HTTP blocked: since Android 9, unencrypted HTTP is forbidden by default; the React Native template only allows it in debug. A custom
network_security_configor edited manifest can block Metro. - Corrupted cache after switching branches or React Native versions.
Step-by-step fix
-
Start Metro in its own terminal
Start Metro from the project root and keep that terminal open. If port 8081 is taken by an old process, close it or start on another port.
npx react-native start --reset-cache # Expo projects npx expo start -c -
Relaunch the app
In a second terminal, reinstall the app so it connects to the running Metro. On the red screen you can also tap "Reload" (press
rin the Metro terminal).npx react-native run-android -
Forward the port to a USB device
With a phone connected over USB, forward the phone’s port 8081 to your computer. Redo it after each unplug or adb restart.
adb devices adb reverse tcp:8081 tcp:8081 -
Set the IP over Wi-Fi
Without a cable, open the dev menu (shake the device or
adb shell input keyevent 82) > Settings > Debug server host & port for device, then enterYOUR_PC_IP:8081. Phone and computer must be on the same network, and the firewall must allow port 8081. -
Build a real release
An APK meant to run without Metro must be built in release: the React Native Gradle plugin then generates and embeds the bundle automatically. Do not install a debug APK on a device without Metro.
cd android ./gradlew assembleRelease # APK: android/app/build/outputs/apk/release/app-release.apk -
Clean the Android project
If nothing changes, uninstall the app from the device, clean the Gradle build, then start again from step 1.
adb uninstall com.yourapp cd android && ./gradlew clean && cd ..
Did this fix work for you?
Confirm it in one click: it will rise for the next developers stuck on the same error.
Keep it from coming back
- Always start Metro before
run-android, and keep it in a separate terminal so you can see its errors. - Add
adb reverse tcp:8081 tcp:8081to an npm script if you often test on a USB device. - Do not manually copy a bundle into
src/main/assetsfor a debug build: it is a workaround that causes duplicate resources. Use a real release build.
Frequently asked questions
Why does it work on the emulator but not on my phone?
The Android emulator reaches your computer automatically, a physical device does not. Run adb reverse tcp:8081 tcp:8081 over USB, or set your computer’s IP in the dev menu over Wi-Fi.
How do I change the Metro port?
Run npx react-native start --port 8088 then npx react-native run-android --port 8088, and adjust adb reverse tcp:8088 tcp:8088.
What is the iOS equivalent?
The message is "No bundle URL present". Check that Metro is running, then relaunch from Xcode or npx react-native run-ios; on a physical iPhone, computer and phone must be on the same network.
Useful tools for this error
More Mobile (Android, iOS) errors
- Fix "SDK location not found" (ANDROID_HOME / sdk.dir) on Android
- Fix "CocoaPods could not find compatible versions for pod" on iOS
- Fix "Signing for "App" requires a development team" in Xcode
- Fix "INSTALL_FAILED_UPDATE_INCOMPATIBLE: signatures do not match" on Android
- Fix "Duplicate class ... found in modules" in an Android Gradle build
- Fix "cmdline-tools component is missing" and "Android license status unknown" (flutter doctor)
- Fix "Invariant Violation: "main" has not been registered" (React Native / Expo)