First, let's make a key - certificate that we will use for debug and release signing. So we don't make two key files. The official documented why by React Native is to make the keystore via command line. But since this is a bit complex, we will suggest the following steps.
Open android studio
Make new app, doesn't matter what you enter.
Go to Build->Generate Signed Bundle / APK, click next
Select Android App Bundle or APK ( it is the same ) , click next
Click on "Create new" to create new keystore
For keystore path, select your project folder, and then go in android/app/production.keystore
For passwords, and aliases use your values. Remember them.
After you have made the keystore, open android/app/build.gradle
and around line 155, change the values of the release element with the values you have.
release {storeFile file('production.keystore')storePassword 'android'keyAlias 'android'keyPassword 'android'}
For reference, look into this video
To run the app on Android Emulator, you will first need to manually start the android Emulator via Android Studio. You should already have to download the Android Studio in step 1 - the Environment setup. In that guide, there is also really good information on how to prepare a real device or starting the Android Emulator. Search for "Preparing the Android device" in the React native docs.​
Once you have the emulator started or a device connected via USB ( and developer mode enabled and USB debugging allowed ), you should be able to start the app on the. To do that, run the following command at the root of the project.
npm run android
After this, you should see the app running on your emulator or connected device.
The full guide we followed is here.
Next, if you are happy with how the app looks, it is time to compile the app and sign it with the distribution Keystore you did before.
First, you need to have the react-native package manager up and running. In the rood of your project execute the following command.
react-native start
This will start the package manager.
Open a new terminal window, and navigate to your project android folder, and then execute the command
./gradlew bundleRelease
cd android./gradlew bundleRelease
If all goes well you should have the app as .aab file in android/app/build/outputs/bundle/release/app-release.aab
.aab files are preferred for Google Play, because Google will optimize the app size. But you can also create .apk file if you like with the following command.
./gradlew assembleRelease
This .aab file, should be uploaded on Google Play
After you have the .aab file it is time to upload this file on google play. As mentioned before, you will need a Google Developer account.
Login into your Google Play developer console.
The process of uploading the app to Google Play is perfectly explained here https://instabug.com/blog/how-to-submit-your-app-to-the-google-play-store/​
If you face any problems, don't hesitate to let us know on our support chat.
​