How to publish Flutter app on Play Store: Beginner guide

Mon, Apr 24, 2023

Read in 2 minutes

In this post we take a look at how to publish a flutter app on Play Store

Signing the app

To publish on the Play Store, you need to give your app a digital signature. Use the following instructions to sign your app.

Create an upload keystore

On Mac/Linux, use the following command:

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

On Windows, use the following command:

keytool -genkey -v -keystore %userprofile%\upload-keystore.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias upload

This command stores the upload-keystore.jks file in your home directory.

Reference the keystore from the app

Create a file named [project]/android/key.properties that contains a reference to your keystore:

storePassword=<password from previous step>
keyPassword=<password from previous step>
keyAlias=upload
storeFile=<location of the key store file, such as /Users/<user name>/upload-keystore.jks

*Warning: Keep the key.properties file private; don’t check it into public source control.

Configure signing in gradle

Configure gradle to use your upload key when building your app in release mode by editing the [project]/android/app/build.gradle file.

``

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

This loads the key.properties file into the keystoreProperties object.

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
       }
   }

And replace it with the following signing configuration info:

signingConfigs {
       release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword keystoreProperties['storePassword']
       }
   }
   buildTypes {
       release {
           signingConfig signingConfigs.release
       }
   }

Shohruh AK





See Also

How to Create Dotted Border Container in Flutter
FocusableActionDetector Flutter Widget: How to use it
How to Use 'sqflite_ffi' Database Package in Flutter
What Skills a Flutter Developer Should Have
How does ChatGPT actually works?