Creating APKs from AAB Using BundleTool
Parth V.
Jan 05 2026
With Google Play requiring Android App Bundles (AAB) for distribution, many teams treat APKs as a secondary artifact — or skip them entirely.
In real production workflows, however, APK testing is still essential. QA teams, clients, and release managers often need to install and validate a build before Play Store submission.
Instead of maintaining two separate build pipelines, a more reliable approach is to generate APKs directly from the AAB. This ensures that what you test locally is exactly what Google Play will process and deliver to users.
Why Generate APK from AAB in Real Projects?
Production-Equivalent Testing
When you generate an APK directly from the AAB, you are testing the same artifact that Google Play uses to create device-specific APKs.
This eliminates common sources of mismatch:
- Incorrect build variants
- Misconfigured signing
- Environment or feature-flag drift
In short: what you test locally is what users receive in production.
Faster Verification Without Rebuilds
A common release-time question is:
“Is this build definitely pointing to production?”
Without APK-from-AAB, answering this often means rebuilding the app — wasting time and introducing risk.
By generating an APK from the existing AAB, verification becomes instant: install, validate, and proceed with confidence.
Client, QA, and Store Readiness
APKs generated from AAB are ideal for:
- Client acceptance testing
- QA validation of critical flows (login, payments, deep links)
- Catching Play Store issues early — before submission
Step 1: Generate an AAB File
Option 1: Using Android Studio
- 1. Go to Build → Generate Signed App Bundle or APK
- 2. Select Android App Bundle
- 3. In the next window:
- Select keystore path
- Add keystore password
- Add key alias
- Add key password
- 4. Click Next and choose Release to generate the AAB.
Option 2: Using Gradle Configuration
-
1. Open
android/app/build.gradle -
2. Add the release configuration under
android → signingConfigs:
release {
storeFile file('PATH_TO_KEYSTORE_FOLDER/sst.jks')
storePassword 'STORE_PASSWORD'
keyAlias 'KEYSTORE_ALIAS'
keyPassword 'KEY_PASSWORD'
}
- 1. Sync Gradle
- 2. Clean the project:
release ./gradlew clean
- 3. Generate the bundle:
./gradlew bundleRelease
Step 2: Install BundleTool
To generate APK from AAB, Google provides BundleTool. BundleTool is the same tool used internally by Google Play to convert app bundles into installable APKs. Using it locally allows you to reproduce Play Store behavior with high fidelity.
Install using Homebrew:
brew install bundletool
Or download it directly from the official GitHub repository.
Step 3: Generate APK from AAB
When bundletool generates APKs from your app bundle, it creates an APK Set Archive (.apks), which contains all generated APKs.
bundletool build-apks \
--bundle=PATH_TO_AAB_FOLDER/app-release.aab \
--output=PATH_TO_OUTPUT_FOLDER/my_app.apks \
--ks=PATH_TO_KEYSTORE_FOLDER/sst.jks \
--ks-pass=pass:KEYSTORE_PASSWORD \
--ks-key-alias=KEYSTORE_ALIAS \
--key-pass=pass:KEY_PASSWORD \
--mode=universal
Command Explanation:
- — bundle→ Path to the AAB file
- — output→ Output file with .apks extension
- — ks→ Keystore path
- — ks-pass→ Keystore password
- — ks-key-alias→ Keystore alias
- — ks-key-pass→ Key password
- — mode=universal→ Creates a single APK compatible with all supported devices.
The universal mode generates a single APK containing all supported configurations. While larger in size, it is ideal for testing and validation.
Step 4: Extract Universal APK
-
After running the above command,
.apksfile will be created at your defined output path. -
Rename the file extension from
.apks to .zip - Extract the zip file
-
Inside the extracted folder, locate the
universal.apkfrom theapkfolder
Now you can test or distribute this universal.apkfor testing purposes.
Automate the Entire Process
To save time and avoid manual errors, you can automate everything using a shell script.
Example: generate_apk.sh
#!/bin/bash
AAB_PATH="PATH_TO_AAB_FOLDER/app-release.aab"
OUTPUT_APKS="PATH_TO_OUTPUT_FOLDER/my_app.apks"
KEYSTORE_PATH="PATH_TO_KEYSTORE_FOLDER/sst.jks"
KS_PASS="KEYSTORE_PASSWORD"
KEY_ALIAS="KEYSTORE_ALIAS"
KEY_PASS="KEY_PASSWORD"
bundletool build-apks \
- bundle=$AAB_PATH \
- output=$OUTPUT_APKS \
- ks=$KEYSTORE_PATH \
- ks-pass=pass:$KS_PASS \
- ks-key-alias=$KEY_ALIAS \
- key-pass=pass:$KEY_PASS \
- mode=universal
cd "$(dirname "$OUTPUT_APKS")"
cp "$(basename "$OUTPUT_APKS")" my_app.zip
unzip -o my_app.zip -d extracted_apk
echo "Universal APK generated at: extracted_apk/universal.apk"
▶️ Run the Script
chmod +x generate_apk.sh
./generate_apk.sh
After successful execution, the extracted_apk folder will contain the final universal APK.
This script can be easily integrated into CI pipelines to automatically produce testable APKs alongside release bundles.
Final Thought
Although Android App Bundles are mandatory for Play Store submission, APK testing remains a critical part of a reliable release process.
Generating APKs directly from AABs:
- Reduces store rejections
- Improves release confidence
- Speeds up client and QA validation
By treating the AAB as the single source of truth, teams can test exactly what they ship — without redundant builds or unnecessary risk.