APK vs AAB in Flutter: APKs are installable Android packages (great for side-loading and services like DeployGate), while AABs are publishing bundles required by Google Play. This guide shows how to build both, sign them, and choose the right artifact for each stage.
Audience: IntermediateTested on: Flutter 3.x, Dart 3.x, Android 14, macOS/Windows
Quick definitions
- APK — Installable file you can share directly or upload to services like DeployGate. One file contains native code + resources for some or all ABIs/densities.
- AAB (Android App Bundle) — Publishing format for Google Play. Play uses your AAB to generate optimized, device-specific APKs (split delivery). Required for production since 2021.
Set up signing (one time)
# 1) Generate keystore (example)
keytool -genkey -v -keystore my-release-key.jks -alias my-key-alias \
-keyalg RSA -keysize 2048 -validity 10000
# 2) android/key.properties
storePassword=********
keyPassword=********
keyAlias=my-key-alias
storeFile=../my-release-key.jks
Wire this in android/app/build.gradle
(or build.gradle.kts
) via signingConfigs
and release
buildTypes
.
Build commands (Flutter)
Release APK
# Universal APK (simple to share; larger)
flutter build apk --release
# ABI-split APKs (smaller per device; multiple files)
flutter build apk --release --split-per-abi
Release AAB (Play Store)
flutter build appbundle --release
Artifacts appear under build/app/outputs/apk/release/
and build/app/outputs/bundle/release/
.
When to use APK vs AAB
- Development / QA distribution: APK Share via DeployGate, Firebase App Distribution, or direct install. Use
--split-per-abi
for smaller downloads or Universal APK for simplest installs. - Google Play (Internal/Closed/Open testing & Production): AAB Upload once; Play signs and serves device-optimized APKs (smaller downloads, on-demand features).
Typical pipeline (practical example)
- CI job A (QA):
flutter build apk --release --split-per-abi
→ upload to DeployGate for testers. - CI job B (Store):
flutter build appbundle --release
→ upload the.aab
to Google Play Console (Internal testing → rollout).
Size & performance notes
- AAB on Play yields smaller device downloads via split APKs (native ABI, screen density, language).
- Universal APK is easiest to side-load but larger (contains multiple ABIs).
- Split-per-ABI APKs reduce size but you must deliver the right file per device.
Pro tips
- Versioning: Increment
versionCode
(android/app/build.gradle
) on every Play upload.versionName
is the human-readable version. - Obfuscation & symbols: Use
--obfuscate --split-debug-info=out/symbols/<timestamp>
for reproducible symbol files. - Play App Signing: Prefer Play App Signing (recommended). Keep your upload key safe; Google manages the distribution key.
- Testing tracks: Start with Internal testing → Closed → Open → Production.
Common pitfalls
- Installed APK ≠ Store build: Device-installed APK may include debug configs; always test a release build.
- 64-bit requirement: Ensure your build supports 64-bit ABIs (arm64-v8a) for Play compliance.
- Large icons/splash issues: Regenerate assets after changes (
flutter clean
→ rebuild) to avoid stale resources. - Wrong keystore: Keep the same upload key for future updates or follow Google’s key reset process.
Minimal CI snippets
# APK for DeployGate
flutter pub get
flutter build apk --release --split-per-abi
# <upload step to DeployGate API or CLI>
# AAB for Play
flutter pub get
flutter build appbundle --release --obfuscate --split-debug-info=out/symbols/$(date +%Y-%m-%d_%H%M%S)
# <upload step to Play Console (CLI or manual)>
FAQ
Q. Can I upload an APK to the Play Store production track?
A. Not for new apps; Play requires AAB for publishing. APKs are fine for side-loading and third-party distribution.
Q. Do I need separate signing for APK and AAB?
A. They use the same release signing configuration. If you enable Play App Signing, you’ll use an upload key for the AAB.
Q. Which APK should I share with testers?
A. For simplicity, share the Universal APK. For bandwidth-sensitive testers, share split-per-ABI APKs.
Conclusion
Use APK for rapid external distribution (DeployGate, side-loading) and AAB for anything that touches Google Play. Keep signing consistent, automate both build paths in CI, and version deliberately to ensure smooth releases.
https://docs.flutter.dev/deployment/android
https://developer.android.com/guide/app-bundle
https://support.google.com/googleplay/android-developer/answer/9859152
https://deploygate.com
Updated: 2025-10-14
Comment