Android APK/AAB Signing
Esta página aún no está disponible en tu idioma.
To publish on the Play Store, you need to sign your app with a digital certificate.
Android uses two signing keys: upload and app signing.
Developers upload an .aab
or .apk
file signed with an upload key to the Play Store.
The end-users download the .apk
file signed with an app signing key.
To create your app signing key, use Play App Signing as described in the official Play Store documentation.
To sign your app, use the following instructions.
-
Create an
upload
KeystoreIf you have an existing keystore, skip to the next step. If not, create one using one of the following methods:
-
Following the Android Studio key generation steps
-
Running the following at the command line: On Mac/Linux, use the following command:
keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias uploadOn Windows, use the following command:
keytool -genkey -v -keystore $env:USERPROFILE\upload-keystore.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias uploadThis command stores the
upload-keystore.jks
file in your home directory. If you want to store it elsewhere, change the argument you pass to the-keystore
parameter. However, keep thekeystore
file private; don’t check it into public source control!
-
-
Reference the Keystore from the App
Create a file named
[project]/src-tauri/gen/android/keystore.properties
that contains a reference to your keystore:storePassword=<password from previous step>keyPassword=<password from previous step>keyAlias=uploadstoreFile=<location of the key store file, such as /Users/<user name>/upload-keystore.jks or C:\\Users\\<user name>\\upload-keystore.jks> -
Configure Signing in Gradle
Configure gradle to use your upload key when building your app in release mode by editing the
[project]/src-tauri/gen/android/app/build.gradle.kts
file.-
Add the needed imports at the beginning of the file:
import java.util.Propertiesimport java.io.FileInputStream -
Add the
release
signing config before thebuildTypes
block:signingConfigs {create("release") {val keystorePropertiesFile = rootProject.file("keystore.properties")val keystoreProperties = Properties()if (keystorePropertiesFile.exists()) {keystoreProperties.load(FileInputStream(keystorePropertiesFile))}keyAlias = keystoreProperties["keyAlias"] as StringkeyPassword = keystoreProperties["keyPassword"] as StringstoreFile = file(keystoreProperties["storeFile"] as String)storePassword = keystoreProperties["storePassword"] as String}}buildTypes {...} -
Use the new
release
signing config in therelease
config inbuildTypes
block:buildTypes {getByName("release") {signingConfig = signingConfigs.getByName("release")}}
-
Release builds of your app will now be signed automatically.
© 2024 Tauri Contributors. CC-BY / MIT