React Native CLI build apk code example
Example 1: build apk react native
After run this in cmd
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 app/build/outputs/apk/debug/app-debug.apk
Example 2: react-native android build apk
cd android
./gradlew assembleRelease
Example 3: react native create apk
Place your terminal directory to android using:
cd android
)================
For Windows,
gradlew assembleRelease
)=================
)=================
For Linux and Mac OSX:
./gradlew assembleRelease
)==================
Example 4: export apk react native
Before uploading the release build to the Play Store,
make sure you test it thoroughly.
mkdir -p android/app/src/main/assets
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
react-native run-android --variant=release
Export Apk -
cd android && ./gradlew bundleRelease -x bundleReleaseJsAndAssets
- Your AAB BUNDLE will be present in the folder
<project>/android/app/build/outputs/bundle/release
Example 5: build apk react native
$ keytool -genkeypair -v -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000