react-native build basic Page 6 --- packaged and released

Release signature to distribute a version of the apk installer

How to publish a apk

  1. To ensure that they are properly configured all of the RN environment
  2. In the cmd command line, run these wordskeytool -genkey -v -keystore my-release-key2.keystore -alias my-key-alias2 -keyalg RSA -keysize 2048 -validity 10000
  • Where: my-release-key.keystorerepresents 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]
  1. When generating a signature, the signature, by default saved to their user directoryC:\Users\liulongbin\my-release-key2.keystore
  2. Your signature certificate copy to the android / app directory.
  3. Edit android-> gradle.propertiesFile, 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=*****
  1. 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
        }
    }
}
...
  1. Under the project into the root directory androidfolder, open a terminal in the current directory, and then enter the ./gradlew assembleReleaseRelease version of APK start publishing;
  2. When the release is complete, enter their own project android\app\build\outputs\apkdirectory, locate app-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.

Guess you like

Origin www.cnblogs.com/ygjzs/p/12213203.html