Building the Android Application Package (APK) is a bit more cryptic than releasing for iOS. There are a few steps that we need to follow before we generate the static bundle, like we did in iOS:
keytool
. Navigate to the android/app
folder in a terminal and run this command:$ keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000 [Storing my-release-key.keystore]
android/ directory
open gradle.properties
and add these four lines, replacing YOUR_KEY_PASSWORD
with the password you used for keytool
:MYAPP_RELEASE_STORE_FILE=my-release-key.keystore MYAPP_RELEASE_KEY_ALIAS=my-key-alias MYAPP_RELEASE_STORE_PASSWORD=YOUR_KEY_PASSWORD MYAPP_RELEASE_KEY_PASSWORD= YOUR_KEY_PASSWORD
android/app/build.gradle
:android { ... signingConfigs { release { storeFile file(MYAPP_RELEASE_STORE_FILE) storePassword MYAPP_RELEASE_STORE_PASSWORD keyAlias MYAPP_RELEASE_KEY_ALIAS keyPassword MYAPP_RELEASE_KEY_PASSWORD } } buildTypes { release { ... signingConfig signingConfigs.release } } }
android/app/src/main/assets/
and run this modified form of the react-native bundle
command:react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
This gives the following output:
$ react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ Building package... transforming [========================================] 100% 326/326 Build complete Successfully saved bundle to android/app/src/main/assets/index.android.bundle
android/ directory
using the gradle
command:./gradlew assembleRelease
If you have set up the key signing correctly, you can test your release in the simulator or on a device with the following:
./gradlew installRelease
android/app/build/outputs/apk/app-release.apk
). Check out the launch checklist on Android developers for more information on the Play Store submission process at https://developer.android.com/distribute/tools/launch-checklist.html.3.15.182.25