BREAKING:

Flutter: Deploy app to Play Store

To build and deploy a Flutter app to Google Play, follow these steps:

1. Prepare Your Flutter App

  • Ensure your pubspec.yaml dependencies are up to date.
  • Run flutter analyze and flutter test to check for issues.

2. Configure App for Release

  • Set App Name & Package Name: Update android/app/src/main/AndroidManifest.xml.
  • Set Versioning: Modify pubspec.yaml: yamlCopyEditversion: 1.0.0+1
  • Add Launcher Icon: Use flutter_launcher_icons.
  • Enable ProGuard (optional, for obfuscation): Edit android/app/proguard-rules.pro.

3. Generate a Signed APK or AAB

Create a Keystore File

Run:

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

Store the .jks file securely.

Configure Keystore in Flutter

Edit android/key.properties:

storePassword=<your-store-password>
keyPassword=<your-key-password>
keyAlias=your_key_alias
storeFile=your-key.jks

Then, update android/app/build.gradle:

Add the following lines to top of files

def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

Add the following to Android {} block

signingConfigs {
release {
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
}
}

buildTypes {
release {
signingConfig signingConfigs.release
shrinkResources true
minifyEnabled true
}
}

4. Build the Release Package

To generate an AAB (preferred for Play Store):

flutter build appbundle

For APK:

flutter build apk --release

5. Upload to Google Play Console

  • Go to Google Play Console.
  • Create a new app and complete the required information.
  • Upload the .aab file to the Production, Beta, or Alpha track.
  • Complete the content rating, store listing, and compliance forms.

6. Submit for Review

Once all requirements are met, submit the app for review. Google Play takes a few hours to a few days to approve it.

Would you like help automating this process with a CI/CD pipeline (e.g., using GitHub Actions)?

Post A Comment

Your email address will not be published. Required fields are marked *

Leave a Reply