Steps
1. Generate key
2. Modify the android/app/build.gradle file
3. Modify android/gradle.properties
4. CD android && ./gradlew assembleRelease
Enter a directory and execute
$ keytool-genkey-v-keystore my -release-key.keystore- alias my -key- alias -keyalg rsa-keysize 2048 -validity 10000
The resulting file will be copied to the project directory/android/app under the current directory.
Configure Build.gradle
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 {
Minifyenabled Enableproguardinreleasebuilds
Proguardfiles getdefaultproguardfile ("Proguard-android.txt"), "Proguard-rules.pro"
Signingconfig Signingconfigs.release
}
}
And then modify the Android/gradle.properties
Add the following content
Myapp_release_store_file=my-release-key.keystore
Myapp_release_key_alias=my-key-alias
myapp_release_store_password=123456// The password I tested was 123456.
myapp_release_key_password=123456
Follow the official steps to perform the final step
Cdandroid && ./gradlew assembleRelease,
If you have the NDK installed, then no surprises will successfully package successfully, see in the app/build/outputs/apk directory:
If there is no ndk, download a corresponding version.
After downloading, then add local.properties in the directory.
Add the following content :
Configure the sdk.dir and address
Pay attention to the double rod
Example :
Sdk.dir=d:\\android_sdk
ndk.dir=d:\\android_sdk\\android-ndk-r12b
Finally to the last step ; Enter
Cd android
执行 gradlew assembleRelease
If there is no accident, after the successful execution will be in the app/build/outputs/apk directory to see the dear apk .
React-native Android Pack