How to publish Flutter app in Google Play Store

Jyotishgher Astrology
By -
4 minute read
0

 How to publish Flutter app in Google Play Store?

To publish a Flutter Android app on the Google Play Store, you'll need to set up a Google Play Console developer account, build and sign your app, and then create a new release in the Play Console. You'll also need to create a service account with appropriate permissions for publishing and upload your app bundle or APK file. To generate a signing key for your Flutter Android app and prepare it for release on the Google Play Store, follow these step-by-step instructions in Android Studio or terminal.

How to publish Flutter app in Google Play Store

✅ STEP 1: Generate Keystore (Signing Key)

📍 Run this command in terminal:

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

Mistakes over command :~/ replace where you want to keep the jks file

keytool -genkey -v -keystore "E:\MY APPS\KEYSTORE\any_name.jks" -keyalg RSA -keysize 2048 -validity 10000 -alias any_name

🔒 You’ll be prompted to enter:

  • Keystore password (e.g., your_keystore_password)
  • Your name, organization, country
  • Key password (can be same as keystore password)

🔐 A file named my-key.jks will be created in your home directory.

✅ STEP 2: Move Keystore to Project

Move the my-key.jks file to your project directory, ideally under:

android/app/any_name.jks

✅ STEP 3: Configure key.properties

Create a new file in android/key.properties:

storePassword=your_keystore_password
keyPassword=your_key_password
keyAlias=my-key-alias
storeFile=any_name.jks

✅ STEP 4: Update build.gradle (App Level)

Edit android/app/build.gradle, inside android { ... } block:

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

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
'proguard-rules.pro'
}
}
}

✅ STEP 5: Build the Release App Bundle

Run this command to generate .aab (Android App Bundle):

flutter build appbundle --release

The generated bundle will be in:

build/app/outputs/bundle/release/app-release.aab

ALERT — SOMETIMES YOU WILL GET IN TERMINAL

You’re seeing this error (Too many characters in a character )because you’re trying to use Groovy syntax in a build.gradle.kts (Kotlin DSL) file, which is not compatible. The code like def, new Properties(), and 'keyAlias' are valid in Groovy, but not in Kotlin-based Gradle files.Now syntax will change se

Update android/app/build.gradle.kts

Replace your current keystore config with this correct Kotlin DSL version:

Von't miss to import
import java.util.Properties
import java.io.FileInputStream
val keystoreProperties = Properties()
val keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}
android {

signingConfigs {
create("release") {
keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
storeFile = file(keystoreProperties["storeFile"] as String)
storePassword = keystoreProperties["storePassword"] as String
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
signingConfig = signingConfigs.getByName("release")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
}

✅ STEP 6: Upload to Google Play Console

  1. Go to https://play.google.com/console
  2. Create a new app
  3. Go to Release > Production > Create new release
  4. Upload the .aab file
  5. Fill out content rating, pricing, and store listing


Tags:

Post a Comment

0Comments

Post a Comment (0)