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
}
}
}
To compile in release mode, we just need to add the --release flag to the flutter run command and have a physical device connected. Although we can do so, we typically do not use the flutter run command with the --release flag.
Try modifying your buildTypes block.
buildTypes {
release {
signingConfig signingConfigs.release
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With