Signing APK file in flutter

1 . Create key.properties inside android/key.properties file with the following contents

storePassword=xxxxxxxx
keyPassword=xxxxxxxx
keyAlias=alias-name
storeFile=C:/path/to/.keystore


2. Add the following codes inside android/app/build.gradle file

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

3. Add the following codes inside android/app/build.gradle file's just after default config

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


4. After these build aab file using the following command
flutter build appbundle --release --obfuscate --split-debug-info=/debug_info

5. Then read on another article of how to upload aab file to the store


Comments

Popular posts from this blog

Publishing Flutter app

Solving flutter web app CORS policy