Author: Haider Ali,
For creating cross-platform mobile applications, React Native is a well-liked framework. The next step after developing your React Native app is to publish it on app stores like the Google Play Store. Registering as a Google Play developer, getting the app ready for release, making a release build, and submitting the app for review are all necessary before an app can be published on the Google Play Store.
The processes necessary to publish your React Native app on the Google Play Store are outlined in this guide. Regardless of whether you are an experienced developer or new to the field of mobile app development, this article will give you a clear and comprehensive overview of the steps necessary to have your app accepted by the market.
Generating an upload key
With keytool, you can create a private signing key.
For Windows, keytool must be executed as administrator from
After running this command, you will be asked for password for the keystore and key and Name fields for your key. The key store is then created as a file with the name “my-upload-key.keystore.”
There is just one key in the keystore, and it is good for 10,000 days. Remember to write down the alias because you will need it later when signing your app.
If you’re not sure where your JDK bin folder is on macOS, run the following command:
The JDK directory that is produced by this command will look something like this:
Use the cd command to get to that directory, then run the keytool command with sudo access as following:
Setting up Gradle File
- Put the my-upload-key.keystore file in your project folder’s android/app directory.
- Add the following (replacing ***** with the right keystore password, alias, and key password) to the file /.gradle/gradle.properties or android/gradle.properties
These are going to be global Gradle variables, which we can later use in our Gradle config to sign our app.
Adding signing config to your app's Gradle config
The final configuration step is to set up release builds to be uploaded key-signed. In your project folder, edit the file android/app/build.gradle and add the following signing config.
Generating the release apk
After the configuration if you want to make release apk run the following command:
And if you encounter any error then try this command:
Generating the release AAB
After the configuration if you want to make release aab run the following command:
The created AAB, which is ready to be posted to Google Play, may be located under android/app/build/outputs/bundle/release/app-release.aab.
Enabling Proguard to reduce the size of the APK (optional)
Proguard is a tool that can slightly reduce the size of the APK.
To enable Proguard, edit android/app/build.gradle:
* Run Proguard to shrink the Java bytecode in release builds.