flutter official logo

How to Create a Signed APK in Flutter

If you're ready to publish your Flutter app on the Play Store, you'll need to generate a signed APK. Here's a simple, step-by-step guide to help you through the process.

Note: This post assumes you are using android studio to create flutter app

1. Create a keystore

Open a terminal and run this command to generate a keystore file:

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

After running the command, you'll be prompted to enter the following:

  • Keystore password – This protects your keystore file. You'll use it later in your Gradle config.
  • Your name and organization details – These are certificate details, required but not very important for most apps.
  • Key password – This protects the key itself (can be same as keystore password or different).

This will create a file called my-key.keystore in your current folder. Keep it safe and don’t share it.

2. Move the keystore to your Flutter project

Copy the generated keystore file into your Flutter project’s android/app directory.

3. Configure signing in build.gradle

Edit the file android/app/build.gradle and add the signing config:

android {
    ...
    signingConfigs {
        release {
            storeFile file("my-key.keystore")
            storePassword "your-keystore-password"
            keyAlias "my-key-alias"
            keyPassword "your-key-password"
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled false
            shrinkResources false
            // You can keep proguard disabled unless you're familiar with it
        }
    }
}

Replace your-keystore-password and your-key-password with the passwords you used during keystore creation.

4. Build the signed APK

Use this command to build your release APK:

flutter build apk --release

You’ll find the signed APK at: build/app/outputs/flutter-apk/app-release.apk

5. Test and Upload

Install the APK on a device to test it before uploading to the Play Store.

Tips

  • Don’t upload your keystore or passwords to Git or anywhere online.
  • Store the keystore safely – without it, you can’t update the app later.
  • For better security, consider using environment variables or a local key.properties file.