Build and Install unsigned apk on device without the development server?
You need to manually create the bundle for a debug build.
Bundle debug build:
#React-Native 0.59react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res#React-Native 0.49.0+react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest ./android/app/build/intermediates/res/merged/debug#React-Native 0-0.49.0react-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
Then to build the APK's after bundling:
$ cd android#Create debug build:$ ./gradlew assembleDebug#Create release build:$ ./gradlew assembleRelease #Generated `apk` will be located at `android/app/build/outputs/apk`
P.S. Another approach might be to modify gradle scripts.
Please follow those steps.
Bundle your js:
if you have index.android.js in project root then run
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
if you have index.js in project root then run
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
Create debug apk:
cd android/./gradlew assembleDebug
Then You can find your apk here:
cd app/build/outputs/apk/
React Version 0.62.1
In your root project directory
Make sure you have already directory android/app/src/main/assets/, if not create directory, after that create new file and save as index.android.bundle
and put your file in like this android/app/src/main/assets/index.android.bundle
After that run this
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/cd android && ./gradlew assembleDebug
Then you can get apk
in app/build/outputs/apk/debug/app-debug.apk