What is use of keystore file?

Publishing to Google Play Store

Generating an upload key

On Linux keytool must be run in project.

1. keytool -genkeypair -v -storetype PKCS12 -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

2. Place the my-upload-key.keystore file under the android/app directory in your project folder. 3.Setting up Gradle variables

Edit the file ~/.gradle/gradle.properties or android/gradle.properties, and add the following (replace ***** with the correct keystore password, alias and key password)

                    MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore
                     MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
                      MYAPP_UPLOAD_STORE_PASSWORD=*****
                     MYAPP_UPLOAD_KEY_PASSWORD=*****   

4.Adding signing config to your app's Gradle config

The last configuration step that needs to be done is to setup release builds to be signed using upload key. Edit the file android/app/build.gradle in your project folder, and add the signing config,

android {

...

defaultConfig { ... }

signingConfigs {

release {

if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {

storeFile file(MYAPP_UPLOAD_STORE_FILE)

storePassword MYAPP_UPLOAD_STORE_PASSWORD

keyAlias MYAPP_UPLOAD_KEY_ALIAS

keyPassword MYAPP_UPLOAD_KEY_PASSWORD

}

}

}

buildTypes {

release {

...

signingConfig signingConfigs.release

}

}

} ...

5.Generating the release AAB

cd android

./gradlew bundleRelease

The generated AAB can be found under android/app/build/outputs/bundle/release/app-release.aab, and is ready to be uploaded to Google Play.

Last updated