Publish Flutter App to Google Play Store

Mouli Bheemaneti
2 min readNov 6, 2021

The below mentioned are steps to publish a flutter app to Google Playstore.

Generate your keystore

Create keystore properties file

Update build.gradle file

Update pubspec.yaml file

Build and upload appbundle to Google Play

1. Generate your keystore

Run the following command in Windows:

keytool -genkey -v -keystore C:/Users/USER_NAME/app_name.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias app_name

Run the following command in Mac/Linux:

keytool -genkey -v -keystore ~/app_name.jks -keyalg RSA -keysize 2048 -validity 10000 -alias app_name

2. Create keystore.properties file

Create a new file {project-root}/android/key.properties with the following and replace each field with the details from the previous step.

storePassword=android
keyPassword=android
keyAlias=app_name
storeFile=C:\\Users\\USER_NAME\\app_name.jks

3. Update build.gradle file

  • Open {project-root}/android/app/build.gradle
  • Under defaultConfig , replace the buildTypes block with the following piece of lines
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}

buildTypes {
release {
signingConfig signingConfigs.release
}
}

Add the following lines before android{...}

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

4. Update pubspec.yaml file

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.

5. Build and upload appbundle to Google Play

  1. Run this in the command line in your project root flutter clean; flutter build appbundle --release, this could take up some time.
  2. Meanwhile, login to Google Play Console.
  3. Click on ‘Release Management’ on the left-hand side, then ‘App releases’
  4. Then create a new release, and fill in the details, I like to use the version name as the release name.
  5. By this time, your appbundle would be ready. Upload your appbundle file from: {project-root}/build/app/output/bundle/release/app-release.aab

--

--

Mouli Bheemaneti

A versatile being who loves to Flutter, blog, producing music, video editing.