Flutter Build Release APK (or) AppBundle

Generate the keystore

keytool -genkey -v -keystore ngdeveloper_release_apk.jks -alias ngdeveloper -keyalg RSA -keysize 2048 -validity 10000

Create key.properties with these values in your android folder


Add the key.properties and key details in your build.gradle

Around line no: 27

def keystoreProperiesFile = rootProject.file("key.properties")  
def keystoreProperies = new Properties()  
keystoreProperies.load(new FileInputStream(keystoreProperiesFile))

And inside android { -> next to defaultConfig {

signingConfigs {  
        release {  
            keyAlias keystoreProperies["keyAlias"]  
            keyPassword keystoreProperies["keyPassword"]  
            storeFile file(keystoreProperies["storeFile"])  
            storePassword keystoreProperies["storePassword"]  

Now build release apk (google recommends appbundle – so use any commands from 4th the below)

flutter build apk --release
flutter build apk --release --no-tree-shake-icons
flutter build apk --release --no-tree-shake-icons --no-shrink
flutter build appbundle
flutter build appbundle --no-tree-shake-icons
flutter build appbundle --no-tree-shake-icons --no-shrink

Leave a Reply