Good Day All! I hope you are doing Good.
From last couple of days, Me and my friends were doing comparative study of ionic3 and react-native. During that period, we were struggling to generate release mode APK for React-Native project.
Finally, we came across following solution:
1. Create and then copy a keystore file to android/app
keytool -genkey -v -keystore mykeystore.keystore -alias mykeyalias -keyalg RSA -keysize 2048 -validity 10000
2. Setup your gradle variables in android/gradle.properties
MYAPP_RELEASE_STORE_FILE=mykeystore.keystore
MYAPP_RELEASE_KEY_ALIAS=mykeyalias
MYAPP_RELEASE_STORE_PASSWORD=*****
MYAPP_RELEASE_KEY_PASSWORD=*****
3. Add signing config to 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
}
}
}
4. Generate your release APK:
cd android && ./gradlew assembleRelease
5. Your APK will get generated at: android/app/build/outputs/apk/app-release.apk
Special Thanks to Tyler Buchea : http://blog.tylerbuchea.com/react-native-publishing-an-android-app/
Comments