Lesson 24 / 25
Building and Releasing
App bundles, IPAs, flavors and signing.
From code to the stores
Set the version in pubspec.yaml as version: 1.4.0+12 (name plus build number). For Google Play run flutter build appbundle to produce an .aab; it must be signed with an upload key configured in the Android Gradle files (commonly via a key.properties file kept out of version control). For the App Store run flutter build ipa, which needs Xcode, an Apple Developer account and signing set up in Xcode, then upload through Xcode or Transporter. flutter build web and desktop targets work similarly. Flavors (--flavor staging) produce differently configured apps (bundle ID, name, icons) from one codebase; --dart-define or --dart-define-from-file passes compile-time configuration. --obfuscate --split-debug-info=<dir> shrinks symbol names and keeps the symbols needed to read crash reports. CI services (GitHub Actions, Codemagic, fastlane) automate this.
Release commands
Typical builds; flavors must also be configured natively.
# Android App Bundle for Google Play
flutter build appbundle --release \
--flavor prod \
--dart-define-from-file=config/prod.json \
--obfuscate --split-debug-info=build/symbols
# iOS archive for App Store Connect (on macOS with signing configured)
flutter build ipa --release --flavor prod
# Web build
flutter build web --release
# pubspec.yaml: version: 1.4.0+12 (name+build number)Guard your upload key
Keep keystores and key.properties out of git, back them up securely, and enrol in Play App Signing so a lost upload key can be reset.
Quick check: Which command produces the artifact normally uploaded to Google Play?
- flutter run --release
- flutter build ipa
- flutter build appbundle
- flutter pub publish
Answer
flutter build appbundle — Google Play expects an Android App Bundle (.aab).