Preparing Flutter App For Android Release (Google Play)
The Problem
Flutter app is surprisingly unprepared for the production release on Google Play - the iOS release is a relatively straightforward matter, where XCode (mostly) tells you what's missing, while Android app happily builds but then Google Play store starts throwing errors like "You uploaded an APK or Android App Bundle that was signed in debug mode" or "Keystore file not set for signing config release".
So here's what needs to be done.
The Solution
- 
android/app/build.gradleshould havedefaultConfig.applicationIdset to actual identifier, like e.g.net.hydralien.pictuvert- otherwise the store will complain that it's unavailable. - 
If you're uploading a new build, it's number should be incremented after "+" in
pubspec.yaml(e.g. "version: 1.0.0+1") - 
android/key.propertiesfile should exist (it's hidden from the version control), and have e.g.storePassword=YourPassword keyPassword=YourPassword keyAlias=upload storeFile=/Users/halien/upload-keystore.jks - 
android/app/build.gradleshould have keystore definition at the top, before "android" section:def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } - 
it also needs to define prod signing config before "buildTypes" section, like so:
signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null storePassword keystoreProperties['storePassword'] } } - 
and then inside the "buildTypes" section,
igningConfig signingConfigs.debugshould be changed toigningConfig signingConfigs.release 
With all that in place, running flutter build appbundle should produce a valid production-signed bundle at build/app/outputs/bundle/release/app-release.aab
Hope this saves me some time next time I face this.