How to Generate Signed Android APK of React Native App

Signed APK of Android App

After the development process if you want to upload your application on Google Play Store then you need a signed APK and to generate signed APK you have to generate your signed Keystore which stores your name, company name, password, etc. Let’s see how can we do that?

For the Debug APK you can visit How to Generate Debug APK of Android Project in React Native

How to Generate a signing APK?

To generate Signed APK you need a signed Key which can be generated by following the below steps

1. Run Terminal/Command prompt as administrator

2. Go to your JDK>bin and run the following command which will ask you some details. Fill all the details.

keytool -genkey -v -keystore your-release-key-name.keystore -alias your-release-key-alias -keyalg RSA -keysize 2048 -validity 10000

3. It will generate a Keystore with the name you have given in the command.

4. Copy the Keystore and paste it in Yourproject>android>app directory

5. Open Yourproject>android>gradle.properties in any code editor.

6.  copy and paste the following lines below android.useDeprecatedNdk=true

MYAPP_RELEASE_STORE_FILE=your-release-key-name.keystore
MYAPP_RELEASE_KEY_ALIAS=your-release-key-alias
MYAPP_RELEASE_STORE_PASSWORD=your-release-key-password
MYAPP_RELEASE_KEY_PASSWORD=your-release-key-password

7. Now Open Yourproject>android>gradle.properties in any code editor

8. add the signing config like the screenshot below

...
android {
    ...
    defaultConfig { ... }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        release {
            ...
            signingConfig signingConfigs.release
        }
    }
}
...

9. Now run following command in YourProject>android from the terminal
Windows:

gradlew assembleRelease

Linux:

./gradlew assembleRelease

10. You will find the release APK after the successful run of the command.

This is how you can generate signed APK to upload on Google Play Store. If you are still facing the problem or you have anything to share please comment below or contact us here.

Hope you liked it 🙂


Related Posts

2 thoughts on “How to Generate Signed Android APK of React Native App”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.