Prepare Your Flutter App to Publish to Google Play Store (easiest way)

Damodar Lohani
2 min readJan 26, 2020

--

Now that you have coded your first Flutter app and you want to build a release version and publish it to Google play store. In this article we will learn how to prepare your flutter app to release to Google Play Store.

At this point we assume that you have coded and tested your Flutter app successfully and are ready to release it to the world. To follow this tutorial you can use any of your app that’s working or just create a brand new Flutter project.

Releasing android app to play store has few steps that we need to cover. Most important is that, we need to build a signed apk or appbundle. And to build signed app we need to generate a keystore and signing key. Then we need to configure our build.gradle to use that keystore and key to generate a signed apk or appbundle when we run flutter build apk --releasecommand. Doing all that every time you create a new app is a tedious task. So in this tutorial we will learn how to do that the easiest way.

First of all, add flutter_automation package to your dev dependencies section in pubspec.yaml. If flutter packages get doesn't run automatically, run flutter packages get from terminal to get the newly added dependency. Now setting up a releasing config for Flutter Android app is as simple as running one command from terminal and answering the questions it asks.

So to setup android signing after adding flutter_automation package, from your terminal just run

flutter pub pub run flutter_automation --android-sign

Once you run the command you will be asked a series of questions that are required to generate your keystore and signing keys.

  1. First is the key alias for your signing key, type key alias you desire and press enter.
  2. The dname that is the details of your organization generating the signing key in the format CN=, OU=<organizational_unit>, O=, L=, S=, C=<country_code>
  3. The key password, the password to protect your signing key with. Must be at least 6 characters long
  4. Finally the keystore password, the password to protect your keystore. Must be at least 6 characters long
Preview running the command and entering details from your console
Checkout how to use flutter_automation package and it’s more features

After you enter all the information and press enter, the command will automatically generate the keystore file and save it in keys/keystore.jks. It will also generate key.properties file with the signing keystore and key details and finally add the required configurations in build.gradle file so that you are ready to run flutter build apk --release command to successfully generate a signed apk or appbundle which you can upload to the play store.

Want to connect with me
Facebook: https://fb.me/lohanidamodar
GitHub: https://github.com/lohanidamodar
YouTube: https://youtube.com/c/reactbits
Twitter: https://twitter.com/LohaniDamodar
Linked In: https://www.linkedin.com/in/lohanidamodar/

--

--

Damodar Lohani
Damodar Lohani

Written by Damodar Lohani

Never stop, never fear, life is too short for that.

Responses (4)