Release signature to distribute a version of the apk installer
- Please refer to the following two articles:
- Android ReactNative method of packing APK (trip pit process)
- React Native release APP APK package of signatures
How to publish a apk
- To ensure that they are properly configured all of the RN environment
- In the cmd command line, run these words
keytool -genkey -v -keystore my-release-key2.keystore -alias my-key-alias2 -keyalg RSA -keysize 2048 -validity 10000
- Where:
my-release-key.keystore
represents the name of the signature file that you want to generate a moment [is important to find a small notebook bag down] -alias
Things behind, is also very important, you need to find a small notebook down, the name can be changed according to their needsmy-key-alias
- When you run the command to find the time, you need to enter a number of parameters, find password password will have to get a small notebook [down]
- When generating a signature, the signature, by default saved to their user directory
C:\Users\liulongbin\my-release-key2.keystore
- Your signature certificate copy to the android / app directory.
- Edit
android
->gradle.properties
File, in the end, add the following code:
MYAPP_RELEASE_STORE_FILE=your keystore filename
MYAPP_RELEASE_KEY_ALIAS=your keystore alias
MYAPP_RELEASE_STORE_PASSWORD=*****
MYAPP_RELEASE_KEY_PASSWORD=*****
- Edit android / app / build.gradle file add the following code:
...
android {
...
defaultConfig { ... }
+ 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
}
}
}
...
- Under the project into the root directory
android
folder, open a terminal in the current directory, and then enter the./gradlew assembleRelease
Release version of APK start publishing; - When the release is complete, enter their own project
android\app\build\outputs\apk
directory, locateapp-release.apk
, and this is a complete installation package after we finished publishing; can be uploaded to the major application store for users to use it;
Note: Please remember to properly take care of your key database file, do not upload it to the repository or other places.