You need to sign your APK or Android App Bundle in release mode

2,855

Add

signingConfigs {
       release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
       }

to your /android/app/build.gradle.

To do this, you should also have generated a keystore and referenced it in the build.gradle file before, like:

def keystoreProperties = new Properties()
   def keystorePropertiesFile = rootProject.file('key.properties')
   if (keystorePropertiesFile.exists()) {
       keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
   }

You should also read the docs at: https://flutter.dev/docs/deployment/android.

The appbundle is created by using flutter build appbundle, and it is located in \build\app\outputs\bundle\release. You should submit that bundle file to the play store, you can read more about it at Difference between apk (.apk) and app bundle (.aab)

Share:
2,855
Admin
Author by

Admin

Updated on December 21, 2022

Comments

  • Admin
    Admin over 1 year

    I'm trying to upload the flutter app to the google play store, but it won't let me upload the aab file. The error is saying "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. " and I changed my code like below. enter image description here

    So I changed signinConfigs to release, but getting the same error...

    Also, one of the tutorials has a bundle file, which includes a release file and aab file. (https://youtu.be/zHtco9_Aw7I). But my file structure is something like below. enter image description hereI'm not sure I'm doing correctly or not...

    Also, which file should be added on google play console? I used app.apk but didn't work.