flutter building appbundle in release mode
Solution 1
Flutter has the option to build an appbundle
:
flutter build appbundle
My reference is from this github project.
Solution 2
Try modifying your buildTypes block.
buildTypes {
release {
signingConfig signingConfigs.release
}
}
Solution 3
Make sure you have your keystore file properly set up and referenced in "Android/key.properties". Here is the command to create the keystore:
keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
Then run flutter clean && flutter build appbundle --release
If you get the same error, then try this helpful walkthrough: https://medium.com/@psyanite/how-to-sign-and-release-your-flutter-app-ed5e9531c2ac
![nickt](https://lh5.googleusercontent.com/-desWT7JO7fg/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rciLKMrj91zwxoQfNL_n32TVF55uw/mo/photo.jpg?sz=256)
nickt
Updated on December 26, 2022Comments
-
nickt over 1 year
I have built an app in flutter using android studio and am trying to release it on the play store.
According to https://flutter.dev/docs/deployment/android#reviewing-the-build-configuration, "Run
flutter build appbundle
(Running flutter build defaults to a release build.)"However, when I try to upload this on the play console, I get the error message that "You uploaded an APK or Android App Bundle that was signed in debug mode. You need to sign your APK or Android App Bundle in release mode."
What should I do differently?
From my gradle.build:
def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } android { compileSdkVersion 29 sourceSets { main.java.srcDirs += 'src/main/kotlin' } lintOptions { disable 'InvalidPackage' } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.rtterror.custom_snooze_alarm" minSdkVersion 16 targetSdkVersion 29 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null storePassword keystoreProperties['storePassword'] } } buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug } } }