1, the key to generate the signature
This process will be used keytool , the development of Android should have been exposed to the thing. See Key and certificate management tools for details.
Execute in the project's home directory (not the Android folder):
--Generate signature key, note your key and store password, the following configuration file needs to use Keytool-genkey-v-keystore my-release-key. Keystore-alias My-key-alias- Keyalg rsa-keysize 2048-validity 10000--move keystore files to Android/app/ folder move My-release-key.keystore android/app/
2. Modificationandroid/gradle.propertiesFile, add the following
Myapp_release_store_file=my-release-key. Keystoremyapp_release_key_alias=My-key-aliasmyapp_release_store_password=xx Myapp_release_key_password=xx[Note replace the key and store password set by XX for yourself]
3. Modificationandroid/app/build.gradleSignature configuration in the file:
... 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 } }}
4. Then go to the Android directory to perform the following:
Gradlew Assemblerelease
will be at the end android/app/build/outputs/apk/文件夹中生产可以发布的app-release.apk文件 .
React Native Android Project package release APK step