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
🍎 For macOS / Linux:
- First, find your JDK path:
/usr/libexec/java_home
This will return something like:
/Library/Java/JavaVirtualMachines/jdkX.X.X_XXX.jdk/Contents/Home
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
⚠️ 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
- Move the my-upload-key.keystore file into your React Native project at:
android/app/my-upload-key.keystore
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
🛡️ Security Tip: Add the keystore and gradle.properties to .gitignore to prevent accidental commits:
android/app/my-upload-key.keystore
android/gradle.properties
⚙️ 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
}
}
}
🛠️ 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
After the build completes, your AAB file will be located at:
android/app/build/outputs/bundle/release/app-release.aab
This is the file you will upload to Google Play.
☁️ Step 5: Upload the AAB to Google Play Console
Go to Google Play Console
Select your app or create a new one
Navigate to Release > Production > Create new release
4.Upload your generated app-release.aab
- 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:
- Build the APK:
cd android
./gradlew assembleRelease
- Locate the APK at:
android/app/build/outputs/apk/release/app-release.apk
Top comments (0)