How to Build and Upload an AAB for Closed Testing in 2026 (Android Studio, Flutter & React Native)
Since August 2021, Google Play has permanently deprecated legacy APK submissions for all newly created applications, mandating the Android App Bundle (.aab) publishing format. By shifting package assembly to Google Play’s Dynamic Delivery infrastructure, the AAB format generates smaller, optimized device-specific APKs tailored precisely to each user’s CPU architecture (arm64-v8a, armeabi-v7a, x86_64), screen density (hdpi, xhdpi, xxhdpi), and locale resources.
However, generating a production-compliant, cryptographically signed release bundle that passes Google Play Console’s automated pre-flight security audits can be a daunting process. Between configuring upload keystores, complying with Google Play App Signing, targeting Android 15 (API level 35), managing Proguard/R8 code minification, and structuring release notes, developers frequently spend days wrestling with build failures before their closed test even begins.
In this end-to-end technical tutorial, our mobile DevOps engineers walk you through every step of building and uploading a production-ready AAB across Native Android (Kotlin), Flutter, and React Native, along with solutions to the 10 most common Google Play Console upload errors.
Table of Contents
Tutorial Steps- Step 1: Cryptographic Upload Keystore Generation
- Step 2: Understanding Google Play App Signing Architecture
- Step 3A: Building an AAB in Native Android (Kotlin / Gradle KTS)
- Step 3B: Building an AAB in Flutter (Cross-Platform)
- Step 3C: Building an AAB in React Native & Expo
- Step 4: Proguard & R8 Deobfuscation Mapping Files
- Step 5: Step-by-Step Console Track Upload Workflow
- Resolving the 10 Most Common Play Console Upload Errors
- Frequently Asked Questions on AAB Compilation
Step 1: Cryptographic Upload Keystore Generation
Every Android App Bundle must be digitally signed with a cryptographic private key before Google Play will accept it. When deploying to Google Play, you use an Upload Key. Google verifies your upload key, strips it, and re-signs your app with your permanent App Signing Key held in Google's secure cloud infrastructure.
To generate a production-grade Java Keystore (JKS), open your terminal and execute the JDK keytool command:
keytool -genkey -v \
-keystore upload-release-key.jks \
-keyalg RSA \
-keysize 2048 \
-validity 10000 \
-alias upload-key-alias
You will be prompted to answer several security questions:
- Keystore Password: Choose a strong, 20+ character passphrase containing uppercase, lowercase, numbers, and symbols.
- Distinguished Name Fields: Enter your developer name or organization name, organizational unit, city, state, and two-letter country code.
- Key Password: Press
Enterto use the same password as the keystore.
Save upload-release-key.jks and its credentials in an encrypted password manager or secure vault. While Google allows developers to reset upload keys through developer support, the reset process takes 3 to 5 business days and delays your release pipeline. Never commit your keystore or passwords to public GitHub repositories!
Step 2: Understanding Google Play App Signing Architecture
Google Play App Signing is mandatory for all new applications. It separates app signing into two distinct cryptographic keys:
| Key Type | Managed By | Location | Function |
|---|---|---|---|
| Upload Key | Developer | Your local workstation / CI server | Used solely to sign your compiled AAB before uploading to Google Play Console. |
| App Signing Key | Google Cloud Key Management (KMS) | Used by Google Play to sign the final optimized APKs distributed to end users. |
When you create your initial release in Google Play Console, accept the default option: "Use Google-generated key". Google will handle key generation, rotation, and security in its hardened infrastructure.
Step 3A: Building an AAB in Native Android (Kotlin / Gradle KTS)
For native Android projects, configure your release build type and signing configuration inside app/build.gradle.kts:
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
}
android {
namespace = "com.yourcompany.yourapp"
compileSdk = 35
defaultConfig {
applicationId = "com.yourcompany.yourapp"
minSdk = 24
targetSdk = 35 // Mandatory target for 2026 releases
versionCode = 1
versionName = "1.0.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
create("release") {
storeFile = file("upload-release-key.jks")
storePassword = System.getenv("KEYSTORE_PASSWORD")
keyAlias = "upload-key-alias"
keyPassword = System.getenv("KEY_PASSWORD")
}
}
buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("release")
}
}
}
To compile the production release bundle, execute the Gradle wrapper task in your root project directory:
./gradlew bundleRelease
Once compilation finishes, your signed bundle is located at: app/build/outputs/bundle/release/app-release.aab.
Step 3B: Building an AAB in Flutter (Cross-Platform)
In Flutter applications, avoid hardcoding passwords inside your source tree. Instead, create a properties file at android/key.properties:
storePassword=YourKeystorePasswordHere
keyPassword=YourKeyPasswordHere
keyAlias=upload-key-alias
storeFile=/absolute/path/to/upload-release-key.jks
Add key.properties to your .gitignore file so it is never pushed to remote source control. Then, update android/app/build.gradle to parse the properties:
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
signingConfigs {
release {
keyAlias = keystoreProperties['keyAlias']
keyPassword = keystoreProperties['keyPassword']
storeFile = keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword = keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig = signingConfigs.release
minifyEnabled true
shrinkResources true
}
}
}
Build your release bundle using the Flutter CLI with code obfuscation enabled:
flutter clean
flutter pub get
flutter build appbundle --release --obfuscate --split-debug-info=./build/app/outputs/symbols
Your compiled bundle will be located at: build/app/outputs/bundle/release/app-release.aab.
Step 3C: Building an AAB in React Native & Expo
If you are developing a React Native app utilizing the standalone CLI, place your upload-release-key.jks in the android/app directory. Configure your android/gradle.properties:
MYAPP_UPLOAD_STORE_FILE=upload-release-key.jks
MYAPP_UPLOAD_KEY_ALIAS=upload-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=YourKeystorePassword
MYAPP_UPLOAD_KEY_PASSWORD=YourKeyPassword
Navigate to your android folder and execute the bundle task:
cd android
./gradlew bundleRelease
For React Native applications built with Expo, configure your eas.json profile:
{
"build": {
"production": {
"android": {
"buildType": "app-bundle"
}
}
}
}
Trigger the cloud build using EAS CLI: eas build --platform android --profile production.
Step 4: Proguard & R8 Deobfuscation Mapping Files
When R8 minification is enabled (isMinifyEnabled = true), your Java and Kotlin class names, variable names, and method identifiers are obfuscated into short symbols (e.g. a.b.c()) to reduce bundle size and deter reverse engineering.
However, when a crash occurs in closed testing, Android Vitals will display obfuscated stack traces that are impossible to diagnose unless Google has your deobfuscation mapping file. When you compile an AAB via bundleRelease, R8 automatically bundles the mapping.txt file inside your AAB archive under BUNDLE-METADATA/com.android.tools.build.obfuscation/proguard.map. Google Play extracts and links this file automatically upon upload.
Step 5: Step-by-Step Console Track Upload Workflow
Follow this exact sequence to upload your compiled AAB to your Closed Testing track:
- Log into Google Play Console and select your application.
- In the left sidebar, navigate to Testing > Closed testing.
- Click Manage track on your active track > click Create new release in the upper right corner.
- Under the App bundles section, drag and drop your
app-release.aabfile. Google will upload the bundle, verify upload key cryptographic signatures, and compute dynamic delivery split APK configurations. - Under Release name, enter your semantic version (e.g.,
1.0.0 (1)). - Under Release notes, provide localized release notes using Google's XML tag syntax:
Release Notes Template XML
<en-US> Initial closed beta testing release. Validating authentication, local database storage, and push notifications. </en-US> - Click Next in the bottom right corner. Google will run an automated validation check.
- If zero critical errors are flagged, click Save and publish. Your release will enter Google's automated review pipeline!
AAB Uploaded? Get Your 15 Testers in 6 Hours
Now that your release bundle is uploaded, connect with 15 verified human testers on real devices to begin your 14-day countdown immediately.
- 15 Certified Physical Android Devices
- Zero Dropouts / Continuous 14-Day Streak
- Structured Feedback in Play Console
- 100% Money-Back Approval Guarantee
Resolving the 10 Most Common Play Console Upload Errors
| Google Console Error Message | Root Cause | Concrete Resolution |
|---|---|---|
| "Target API level must be at least 35" | Your targetSdk is set to an older Android release. |
Update targetSdk = 35 in your app-level build.gradle. |
| "Version code 1 has already been used" | Uploading an AAB with a duplicate versionCode. |
Increment versionCode by 1 (e.g., from 1 to 2). |
| "Your APK or App Bundle is signed in debug mode" | Compiled using debug keystore rather than release key. | Verify that signingConfig = signingConfigs.release is applied to the release buildType. |
| "Upload key certificate mismatch" | AAB signed with a different key than registered in Console. | Sign with your registered upload key, or request an upload key reset via Play Console Help. |
| "App bundle contains 32-bit native code but lacks 64-bit" | Native C++ libraries missing arm64-v8a architectures. |
Add ndk.abiFilters 'armeabi-v7a', 'arm64-v8a' in Gradle. |
| "Missing privacy policy" | Release rejected during automated pre-flight scan. | Provide a valid HTTPS privacy policy URL under Policy > App content. |
| "App Bundle contains uncompressed native libraries" | Gradle packaging options configured incorrectly. | Ensure useLegacyPackaging = false is active in packagingOptions. |
| "Package name collision" | Application ID is already claimed by another developer. | Change applicationId in build.gradle to a unique domain namespace. |
| "Missing export declaration on intent filters" | Activities with intent filters missing explicit android:exported. |
Add android:exported="true" or "false" in AndroidManifest.xml. |
| "16KB page alignment warning" | Native shared libraries compiled with 4KB ELF boundaries. | Update NDK to r27+ and compile with -Wl,-z,max-page-size=16384. |
9. Frequently Asked Questions on AAB Compilation
Yes. You cannot install an .aab file directly on Android. Instead, use Google's official bundletool command-line utility to extract an APK set (.apks) and install it to your connected device:
bundletool build-apks --bundle=app-release.aab --output=app.apks --mode=universal
bundletool install-apks --apks=app.apks
versionCode is a mandatory positive integer (1, 2, 3...) evaluated programmatically by Google Play and the Android OS to determine whether an update is newer. versionName is an arbitrary string displayed to end users (e.g. "1.0.0-beta"). Every new upload to Play Console must have a strictly higher versionCode than previous uploads.