fifi 24
fifi 24

Reputation: 31

how to generate .aab from project flutter

i want to generate an .aab file from flutter project using this command

flutter build appbundle

💪 Building with sound null safety 💪

Removed unused resources: Binary resource data reduced from 1224KB to 1154KB: Removed 5%
Running Gradle task 'bundleRelease'...                             47.8s
✓ Built build/app/outputs/bundle/release/app-release.aab (21.7MB).

to put it in play.google.com but i get this problem

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

so in the file android/app/build.gradle i did some modification

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.release
    }
}

but i get the same problem the .aab is in debug mode and not in release mode how to do it to upload the application in play store ?

Upvotes: 3

Views: 17557

Answers (2)

Don
Don

Reputation: 97

In your app build.gradle add a signingConfigs and add release details that will be used to sign your app. Like this

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

And in your android directory add a file key.properties and in it add

storePassword=******
keyPassword=*****
keyAlias=alias_name
storeFile=/home/user/file

Change those details to your signing key details.

Check this link if you don't know how to generate your key store using Android Studio. https://developer.android.com/studio/publish/app-signing#generate-key

Upvotes: 0

Delmontee
Delmontee

Reputation: 2364

You need to sign the app and use the release version, not the debug. Their web page explains how: https://docs.flutter.dev/deployment/android#signing-the-app

Upvotes: 1

Related Questions