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-aliasMistakes 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.jkswill 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 --releaseThe generated bundle will be in:
build/app/outputs/bundle/release/app-release.aabALERT — 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 importimport java.util.Properties
import java.io.FileInputStreamval 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
- Go to https://play.google.com/console
- Create a new app
- Go to Release > Production > Create new release
- Upload the
.aabfile - Fill out content rating, pricing, and store listing


Post a Comment
0Comments