You can generate a private signing key using
keytool. On Windows
keytool must be run from
This command prompts you for passwords for the keystore and key, and to provide the Distinguished Name fields for your key. It then generates the keystore as a file called
The keystore contains a single key, valid for 10000 days. The alias is a name that you will use later when signing your app, so remember to take note of the alias.
Note: Remember to keep your keystore file private and never commit it to version control.
my-release-key.keystorefile under the
android/appdirectory in your project folder.
~/.gradle/gradle.propertiesand add the following (replace
*****with the correct keystore password, alias and key password),
These are going to be global gradle variables, which we can later use in our gradle config to sign our app.
Note about saving the keystore:
Once you publish the app on the Play Store, you will need to republish your app under a different package name (losing all downloads and ratings) if you want to change the signing key at any point. So backup your keystore and don't forget the passwords.
Note about security: If you are not keen on storing your passwords in plaintext and you are running OSX, you can also store your credentials in the Keychain Access app. Then you can skip the two last rows in
Edit the file
android/app/build.gradle in your project folder and add the signing config,
Simply run the following in a terminal:
android/app/build.gradle to see how you can update it to reflect these changes.
The generated APK can be found under
android/app/build/outputs/apk/app-release.apk, and is ready to be distributed.
Before uploading the release build to the Play Store, make sure you test it thoroughly. Install it on the device using:
--variant=release is only available if you've set up signing as described above.
Proguard is a tool that can slightly reduce the size of the APK. It does this by stripping parts of the React Native Java bytecode (and its dependencies) that your app is not using.
IMPORTANT: Make sure to thoroughly test your app if you've enabled Proguard. Proguard often requires configuration specific to each native library you're using. See
To enable Proguard, edit
You can edit the content above on GitHub and send us a pull request!