Skip to content
FR
  1. LuzineDebug
  2. Mobile (Android, iOS)
  3. Unable to load script. Make sure you're either r…
Mobile (Android, iOS) Beginner ≈ 10 min to fix

Fix "Unable to load script" (index.android.bundle) in React Native

Error message
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.
In short

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.

Be the first to confirm this fix

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

  1. Metro is not running or crashed (port 8081 already in use, syntax error at startup).
  2. Physical device cannot see Metro: over USB, localhost means the phone, not your computer, until adb reverse is set up; over Wi-Fi, the IP is not configured or a firewall blocks the port.
  3. 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.
  4. 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_config or edited manifest can block Metro.
  5. Corrupted cache after switching branches or React Native versions.

Step-by-step fix

  1. 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.

    bash
    npx react-native start --reset-cache
    # Expo projects
    npx expo start -c
  2. 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 r in the Metro terminal).

    bash
    npx react-native run-android
  3. 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.

    bash
    adb devices
    adb reverse tcp:8081 tcp:8081
  4. 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 enter YOUR_PC_IP:8081. Phone and computer must be on the same network, and the firewall must allow port 8081.

  5. 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.

    bash
    cd android
    ./gradlew assembleRelease
    # APK: android/app/build/outputs/apk/release/app-release.apk
  6. Clean the Android project

    If nothing changes, uninstall the app from the device, clean the Gradle build, then start again from step 1.

    bash
    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:8081 to an npm script if you often test on a USB device.
  • Do not manually copy a bundle into src/main/assets for 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

All Mobile (Android, iOS) errors →