When you have completed developing a mobile application using React Native the next thing which you will focus on is Publishing the APK in Google Play Store
Objectives
- Generating a Debug APK
- Generating a Signed APK (Release Version)
- Publishing the APK in Google Play Store
Generating a Debug APK
We will see how to generate a debug APK in react native version 0.58 and above
- In your project folder navigate to Android > App > Build > Intermediates
- In Intermediates Folder Create a new folder named assets
Go to your project directory and open terminal and paste the below command
react–native bundle —platform android —dev false —entry–file index.js —bundle–output android/app/src/main/assets/index.android.bundle —assets–dest android/app/src/main/res
Once done navigate to the Android folder using the below command
ccd android
Run the below command to generate the debug APK
./gradlew assembleDebug (For Linux / Mac)
.gradlew assembleDebug (For Windows)
Once the APK is built navigate to Android > App > Build > Outputs > Apk > Build.
Generating a Signed APK (Release Version)
We will see how to create a signed APK now
Creating a Private Signing Key
For creating a signing key, you can use keytool
.
If you are on Windows, keytool
can be found at C:\Program Files\Java\jdkx.x.x_x\bin
. Open a command prompt with Run as administrator.
Run the following code which generates a keystore valid for 10000 days under the file name my-key.keystore
.
keytool -genkey -v -keystore my-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
Fill the details and enter the password which you have created for the keystore file
Alias is a name that you will use later when signing your app, so remember to take note of the alias.
Don’t ever commit your keystore file to your version control and keep it private and safe
Now you are done with the first step of creating an APK now!
Adding Keystore to your project
Now, you have to place the created Keystore file under the android/app
directory in your react native project folder
Next, add the following lines to gradle.properties
MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=*****
MYAPP_UPLOAD_KEY_PASSWORD=*****
Adding signing config to your app’s Gradle config
android/app/build.gradle
Generating the release AAB
cd android
./gradlew bundleRelease
Another post:
- How to animate shape divider in elementor
- 5 Reasons Why You Should Not Use Nulled WordPress Themes and Plugins
- Debug WordPress, the right way
- Most common HTTP error codes explained and how do you troubleshoot them
- How to change logo color when scrolling in Elementor
- Create animated gradient background with elementor
- Introducing Elementor Blocks for Gutenberg
- How to Create Your First React Hook from Start to Finish
Check out our categories: Android Update, Elementor, flutter, Guide, Game, Plugin, Theme, webmaster, SEO