Site icon NgDeveloper

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

storePassword=NGffoigDEVSC#23978232
keyPassword=NGffoigDev#23978232
keyAlias=ngdeveloper
storeFile=D:\\Bitbucket\\tallyfree-app\\ngdeveloper_release_apk.jks

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
(or)
flutter build apk --release --no-tree-shake-icons
(or)
flutter build apk --release --no-tree-shake-icons --no-shrink
(or)
flutter build appbundle
(or)
flutter build appbundle --no-tree-shake-icons
(or)
flutter build appbundle --no-tree-shake-icons --no-shrink
Exit mobile version