DEV Community

Sachin-senapati
Sachin-senapati

Posted on

How to Sign and Upload Your Android App to Google Play using App Signing by Google Play

Before you can upload your Android app to the Play Store, it must be digitally signed. This guide walks through signing your React Native (or native Android) app using a keystore, generating a release AAB (Android App Bundle), and configuring Google Play App Signing.

Since 2017, Google offers App Signing by Google Play, which helps you securely manage your app’s signing keys. When using this method, you need to sign your app with an upload key before uploading.


🔐 Step 1: Generate the Upload Key (Keystore)

🪟 For Windows:
Open Command Prompt as Administrator and navigate to the JDK bin directory (e.g., C:\Program Files\Java\jdkx.x.x_x\bin), then run:

keytool -genkeypair -v -storetype PKCS12 -keystore my-upload-key.keystore -alias upload_key -keyalg RSA -keysize 2048 -validity 10000
Enter fullscreen mode Exit fullscreen mode

🍎 For macOS / Linux:

  1. First, find your JDK path:
/usr/libexec/java_home
Enter fullscreen mode Exit fullscreen mode

This will return something like:

/Library/Java/JavaVirtualMachines/jdkX.X.X_XXX.jdk/Contents/Home
Enter fullscreen mode Exit fullscreen mode

2.Navigate to that directory and run:

sudo keytool -genkeypair -v -storetype PKCS12 -keystore my-upload-key.keystore -alias upload_key -keyalg RSA -keysize 2048 -validity 10000
Enter fullscreen mode Exit fullscreen mode

⚠️ Important: Keep the .keystore file and all passwords (store, key, alias) secure. Losing them means you won’t be able to update your app in the future.

📁 Step 2: Add the Keystore to Your React Native Project

  1. Move the my-upload-key.keystore file into your React Native project at:
android/app/my-upload-key.keystore
Enter fullscreen mode Exit fullscreen mode

2.Open android/gradle.properties and add the following lines (replace values with your actual passwords and alias):

MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=upload_key
MYAPP_UPLOAD_STORE_PASSWORD=your_keystore_password
MYAPP_UPLOAD_KEY_PASSWORD=your_key_password
Enter fullscreen mode Exit fullscreen mode

🛡️ Security Tip: Add the keystore and gradle.properties to .gitignore to prevent accidental commits:

android/app/my-upload-key.keystore
android/gradle.properties
Enter fullscreen mode Exit fullscreen mode

⚙️ Step 3: Configure Gradle to Use the Upload Key

Open android/app/build.gradle and edit it to use your signing config:

android {
    ...
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
                storeFile file(MYAPP_UPLOAD_STORE_FILE)
                storePassword MYAPP_UPLOAD_STORE_PASSWORD
                keyAlias MYAPP_UPLOAD_KEY_ALIAS
                keyPassword MYAPP_UPLOAD_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        release {
            ...
            signingConfig signingConfigs.release
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

🛠️ Make sure to add this block inside the android {} block in your build.gradle.

🧱 Step 4: Generate the Release AAB File

Run the following commands to clean and build the AAB:

cd android
./gradlew clean
./gradlew bundleRelease
Enter fullscreen mode Exit fullscreen mode

After the build completes, your AAB file will be located at:

android/app/build/outputs/bundle/release/app-release.aab
Enter fullscreen mode Exit fullscreen mode

This is the file you will upload to Google Play.

☁️ Step 5: Upload the AAB to Google Play Console

  1. Go to Google Play Console

  2. Select your app or create a new one

  3. Navigate to Release > Production > Create new release

4.Upload your generated app-release.aab

  1. Complete the release process and submit for review 🧠 Note: If this is your first release, you'll be prompted to opt-in to App Signing by Google Play. This will let Google manage your app signing key, and you will only need to manage your upload key.

🧪 Optional: Test the Release APK Locally

To test your signed release build before publishing:

  1. Build the APK:
cd android
./gradlew assembleRelease
Enter fullscreen mode Exit fullscreen mode
  1. Locate the APK at:
android/app/build/outputs/apk/release/app-release.apk
Enter fullscreen mode Exit fullscreen mode

Top comments (0)