Publish your Flutter app to Google Play Store

App-signing, building artifacts and releasing your app to Google and Apple. Here we tried to simplify to make sign APK for submit App to Google Play Store.

1. Generate your keystore

Every app needs to be digitally signed by its own keystore (a .jks file) before being uploaded to Google or Apple. When you deploy newer versions, they will use the digital signature to verify the authenticity of the upload. Here we add some simple step to create keystore file.

Run the following command to generate your keystore on Mac/Linux:

keytool -genkey -v -keystore ~/[Your keystore name].jks -keyalg RSA -keysize 2048 -validity 10000 -alias [Your Alias name]

Run this on Windows (replace Path with your system path):

keytool -genkey -v -keystore C:/Users/Path/[Your keystore name].jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias [Your Alias name]

2. Create keystore properties file

Create a new file {project-root}/android/ with the following and replace each field with the details from the previous step. DO NOT check this file into version control.

storePassword=[Your password]
keyPassword=[Your password]
keyAlias=[Your keystore name]
storeFile=C:\\Users\\PATH\\Desktop\\[Your keystore name].jks

3. Update build.gradle

  1. Set compileSdkVersionminSdkVersion , and targetSdkVersion to 30. See the documentation for correct Android versioning.
  2. Open {project-root}/android/app/build.gradle
  3. Under defaultConfig, replace the buildTypes block with this fragment of code (use androidx.fragment:fragment:1.0.0 instead of when using AndroidX):
signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
    buildTypes {
        release {
            signingConfig signingConfigs.release

4. Add this block before android {

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

4. Update Pubspec.yaml

Open pubspec.yaml and update the version, the first part before the + sign is the version name, I recommend using semantic versioning. And increment the number after the + sign, it is the version code and if it is not updated Google/Apple could reject your APK.

Typically I like to update my version name semantically, either incrementing the major or minor number like 1.1.0 -> 1.2.0, if it has breaking changes 1.1.0 -> 2.0.0 etc. And I always increment the version number like +1 to +2.

5. Build APK

Run this in command line in your project root flutter clean && flutter build appbundle --release, this could take up to 10 minutes, don’t freak out

Leave a Reply

Your email address will not be published.