Skip to main content

Installing a React Native unsigned debug APK on device

In the React Native documentation it's possible to read about how to create a signed APK for release. But what if you only want to create an unsigned debug APK that doesn't require a developement server to run on device? Couldn't find anything in the official docs about this, but as usual Stack Overflow provided some great information, through this thread with the following simple and efficient solution:

First, from your app's root dir, run the following command:

react-native bundle --dev false --platform android --entry-file index.android.js --bundle-output ./android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest ./android/app/build/intermediates/res/merged/debug

When I ran it the first time I got some strange error, something about not being able to open a .babel.json file. Ran the command again, and no problem the second time.

Then the second and final step:

cd android
./gradlew assembleDebug

After this you should be able to find two APK files in the android/app/build/outputs/apk folder:
  • app-debug.apk
  • app-debug-unaligned.apk
Then just grab the file app-debug-unaligned.apk and install it to your device.

Comments

  1. Only, app-debug.apk is generated. Not the other.

    ReplyDelete
  2. Also that app-debug.apk is not running properly. It still requires js server.

    ReplyDelete
  3. change index.android.js to index.js for latest react version

    ReplyDelete

Post a Comment