React native APK package Android

  1. Find the installation path of javajdkxx.xx.xxxxbin

React native APK package Android
As shown in the figure, here is C: program filesjavajdk1.8.0
CD C: program filesjavajdk1.8.0, enter C: program filesjavajdk1.8.0, execute
keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

React native APK package AndroidThis should succeed. A keystore file called my-release-key.keystore will be generated

React native APK package Android

2. Set gradle variable
Put the newly generated my-release-key.keystore file in the Android / APP folder of your project. Then edit C / users / username /. Gradle / (global configuration, valid for all projects) or project directory / Android / (project configuration, valid only for the project). If you don’t have the file, create one yourself, and add the following code (note that**Replace with the corresponding password)
Like mine
React native APK package Android
3. Add signature configuration to the gradle configuration of the project
Edit Android / APP / build.gradle in your project directory, and add the following signature configuration:
This is on the official website
React native APK package Android
Mine isReact native APK package Android

4. generate apk
$ cd android
$ ./gradlew assembleRelease
(CD Android means to enter the Android directory (if you are already in the Android directory, you don’t need to enter it). . / gradlew assemblyrelease in Mac OS, Linux or windows PowerShell environment means to execute the script file named gradlew in the current directory, and its running parameter is assemblyrelease. Note that. / cannot be omitted; it needs to be removed under the traditional CMD command line of windows. /)
Under the diagram
React native APK package Android

The generated APK file is located in Android / APP / build / outputs / APK / release / app-release.apk, which can already be used for publishing.
React native APK package Android