Introduction
Preparing an Android app for release is a key stage before publishing it on Google Play or other stores. This process involves configuring the build, signing the code, and uploading the package to the developer console. Following this guide will help you avoid common mistakes and ensure a seamless release.
Requirements and Preparation
Before you begin, ensure you have:
- Android Studio of the latest stable version (2023.2 or higher recommended) with Android SDK installed.
- JDK (Java Development Kit) version 11 or higher to use
keytool. - A release keystore or the ability to create a new one.
- A Google Play Developer account (paid registration).
- Basic knowledge of working with Android Studio and the Gradle build system.
Also, ensure your app is ready for release: all features are tested, resources are optimized, and the versionCode and versionName in build.gradle are updated.
Step 1: Create or Prepare the Keystore
The keystore is a storage for digital certificates that sign the APK or AAB. Without the correct keystore, you won't be able to update the app in the future.
If the keystore already exists, ensure you know the password, alias, and file location. If you need to create a keystore, run this command in the terminal:
keytool -genkeypair -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-key-alias
The command will prompt for:
- The keystore password (remember it).
- Owner information (name, organization, country, etc.) — you can fill it in conditionally.
- Alias — for example,
my-key-alias.
⚠️ Important: Store the keystore and passwords in a secure place (e.g., a password manager). Losing the keystore means you cannot update the app on Google Play.
Step 2: Configure signingConfigs in build.gradle
Open the build.gradle file (at the app module level) and configure signing for the release build type.
For Groovy DSL (build.gradle):
android {
signingConfigs {
release {
storeFile file('my-release-key.jks') // Path to keystore
storePassword 'your_store_password' // Keystore password
keyAlias 'my-key-alias' // Key alias
keyPassword 'your_key_password' // Key password
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true // Optional: enable obfuscation
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
For Kotlin DSL (build.gradle.kts):
android {
signingConfigs {
create("release") {
storeFile = file("my-release-key.jks")
storePassword = "your_store_password"
keyAlias = "my-key-alias"
keyPassword = "your_key_password"
}
}
buildTypes {
getByName("release") {
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
}
💡 Tip: Do not store passwords in plain text in
build.gradle. Use environment variables or agradle.propertiesfile:MYAPP_RELEASE_STORE_FILE=my-release-key.jks MYAPP_RELEASE_KEY_ALIAS=my-key-alias MYAPP_RELEASE_STORE_PASSWORD=your_store_password MYAPP_RELEASE_KEY_PASSWORD=your_key_passwordAnd in
build.gradle, reference them viaproject.findProperty("MYAPP_RELEASE_STORE_PASSWORD") as String.
Step 3: Build the Release Package
In Android Studio:
- Select Build → Build Bundle(s) / APK(s).
- For Google Play publishing, Build Bundle(s) is recommended (creates a
.aabfile). If you need an APK, select Build APK(s). - Ensure the release configuration is selected in the dialog.
- After building, files will be located at:
- For AAB:
app/build/outputs/bundle/release/app-release.aab - For APK:
app/build/outputs/apk/release/app-release.apk
- For AAB:
⚠️ Important: If the build fails, check the
signingConfigssettings and ensure the keystore is accessible.
Step 4: Test the Release Build
Before publishing, thoroughly test the release version, as it may differ from the debug build (e.g., due to obfuscation).
For APK:
Install the APK on a device via ADB:
adb install -r app/build/outputs/apk/release/app-release.apk
The -r flag will overwrite an existing app.
For AAB:
Generate an APK from the AAB using bundletool (download it from GitHub):
bundletool build-apks --bundle=app-release.aab --output=app.apks --ks=my-release-key.jks --ks-key-alias=my-key-alias --ks-pass=pass:your_store_password --key-pass=pass:your_key_password
Then install the APK:
bundletool install-apks --apks=app.apks
Check all major usage scenarios, performance, and stability. Pay special attention to features dependent on signing (e.g., dynamic modules or API integrations).
Step 5: Prepare for Publishing in Google Play Console
- Sign in to Google Play Console with your developer account ($25 registration fee).
- Create an app (if you haven't already): click "Create app," select a language, and provide the app name and type.
- Upload the package:
- In the Production or Testing section, click "Create release."
- Upload the
.aabor.apkfile. Google Play will process it and check for policy compliance.
- Fill out metadata:
- Description: short and full, with keywords.
- Graphics: app icon (512x512), screenshots (at least 2 for phones), Feature Graphic (1024x500).
- Category: select the appropriate one.
- Contact details: email, website, phone.
- Configure distribution:
- Countries: select regions for publishing.
- Pricing: free or paid, set currency.
- Content rating: according to app content.
- Review and submit:
- Click "Review release," fix any errors.
- Then "Start rollout to production" or "Begin testing" (for alpha/beta).
Step 6: Publish the App
After Google Play's review (typically several hours to days), you can release the app:
- In Google Play Console, go to Releases → Production.
- Click "Manage release" for your release.
- Select "Release" to publish to production.
- For a staged rollout, specify a user percentage (e.g., 10%) to gather initial feedback.
Monitor the status in the console: the app will appear on Google Play after processing (up to 24 hours). Check the app link and ensure all details are correct.
Verify the Result
- Open your app's page on Google Play from different devices.
- Ensure the app installs and launches correctly.
- Check Statistics in Google Play Console: installs, crashes, reviews.
- If using a staged rollout, monitor feedback from early users.
Potential Issues
Signing Error During Build
- Symptom:
Signing config release is missingorKeystore file not found. - Solution: Check the keystore path in
build.gradle, ensure the file exists. Use an absolute or correct relative path.
versionCode Mismatch
- Symptom: Google Play rejects the upload with "Version code must be higher than previous version."
- Solution: Increase
versionCodeinbuild.gradlefor each new release.versionCodeis an integer that must always increase.
Google Play Validation Failure
- Symptom: Errors during review, e.g., "Policy violation" or "App bundle contains native code."
- Solution: Carefully read Google Play policies. Ensure your app contains no malicious code, uses permissions correctly, and all libraries are compatible.
Lost Keystore
- Symptom: No access to the keystore to sign updates.
- Solution: Unfortunately, without the keystore, updating the app is impossible. You'll need to create a new app with a new package name and keystore. This underscores the importance of backing up your keystore.
Prolonged Review in Google Play
- Symptom: Release stuck in "In review" status longer than usual.
- Solution: Review typically takes several hours up to 2 days. If more than 7 days have passed, check your email for notifications from Google Play or contact support through the console.