React Native: build a debug APK that runs without the Metro server

A debug build normally expects the Metro bundler. To create an APK that runs standalone, bundle the JavaScript into the app first.

  1. In your project root, create the assets folder: mkdir -p android/app/src/main/assets
  2. Bundle the code: npx 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
  3. Build: cd android && ./gradlew assembleDebug
  4. Find the APK in android/app/build/outputs/apk/debug/.

Updated tip: for sharing with testers, use assembleRelease with a proper keystore or distribute through Firebase App Distribution or Play internal testing, and prefer an App Bundle (AAB) for the store.