Build for Android
Create an APK to test on devices, and a signed App Bundle (.aab) to upload to Google Play.
On this page
Before you build
Make sure the base URL, package name and Firebase files are set. See Mobile App Configuration and Firebase Configuration.
Generate an APK
flutter build apkThe file is created in:
build/app/outputs/flutter-apkCopy the APK to an Android phone and install it to test.
Generate split APKs
Split APKs produce smaller files, one per processor type:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abiGenerate an App Bundle (.aab)
Google Play requires an Android App Bundle. It must be signed with your own upload key.
1. Create an upload keystore
Skip this if you already have one. Run the command below once and keep the file safe:
keytool -genkey -v -keystore upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias uploadNever lose the keystore or its passwords
Back up the
.jks file and passwords somewhere private. Do not share them or commit them to a public repository.2. Create key.properties
Create android/key.properties:
storePassword=YOUR_KEYSTORE_PASSWORD
keyPassword=YOUR_KEY_PASSWORD
keyAlias=upload
storeFile=./upload-keystore.jksUse your own strong passwords. Do not use example values.
3. Enable signing in the release build
Open android/app/build.gradle and, inside the release build type, set:
signingConfig = signingConfigs.release4. Build the bundle
flutter build appbundleThe file is created at:
build/app/outputs/bundle/release/app-release.aab✓ Success looks like: app-release.aab exists and is ready to upload in the Google Play Console.