# What is use of keystore file?

**Publishing to Google Play Store**&#x20;

**Generating an upload key**

On Linux keytool must be run in project.

&#x20;1\. keytool -genkeypair -v -storetype PKCS12 -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

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

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***

&#x20;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 {

&#x20;...&#x20;

defaultConfig { ... }&#x20;

signingConfigs {&#x20;

release {&#x20;

if (project.hasProperty('MYAPP\_UPLOAD\_STORE\_FILE')) {&#x20;

storeFile file(MYAPP\_UPLOAD\_STORE\_FILE)

&#x20;storePassword MYAPP\_UPLOAD\_STORE\_PASSWORD&#x20;

keyAlias MYAPP\_UPLOAD\_KEY\_ALIAS&#x20;

keyPassword MYAPP\_UPLOAD\_KEY\_PASSWORD

&#x20;}&#x20;

}&#x20;

}&#x20;

buildTypes {

&#x20;release {

&#x20;...&#x20;

signingConfig signingConfigs.release

&#x20;}&#x20;

}&#x20;

} ...

5.***Generating the release AAB***&#x20;

cd android&#x20;

./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.
