Skip to main content

Step-by-Step Guide for Flutter Android APK Signing and Release

In this guide we will learn how to sign the release version of apk or aab(android app bundle) to publish our flutter app to android play store.

flutter release apk

flutter release apk
flutter release apk

How to sign the apk or app bundle created using flutter ?

To publish your app on Play Store, you need to give your app a digital signature.

step 1 : Create a new keystore file ; if you have an existing keystore , skip this step

  • Run command in your terminal for linux/mac
keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
  • On Windows, use the following command:
keytool -genkey -v -keystore c:/Users/USER_NAME/key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key
  • Fill in the required info inside the terminal
 Enter keystore password: test@12345 
        Re-enter new password: test@12345
        What is your first and last name?
        [test]:  test
        What is the name of your organizational unit?
        [test]:  test
        What is the name of your organization?
        [test]:  test
        What is the name of your City or Locality?
        [test]:  test
        What is the name of your State or Province?
        [test]:  test
        What is the two-letter country code for this unit?
        [tt]:  tt
        Is CN=test, OU=test, O=test, L=test, ST=test, C=tt correct?
        [no]:  yes
 Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days
                for: CN=test, OU=test, O=test, L=test, ST=test, C=tt
        [Storing /home/<user name>/key.jks]
  • Keep the keystore file private; do not check it into public source control.
  • Always keep a backup of the keystore file.
Common errors while signing the app
Command 'keytool' not found
run command :
sudo apt install openjdk-11-jre-headless
sudo apt install openjdk-8-jre-headless 

step 2 : Reference the keystore from the app

  • Create a file name in your android folder
Write the following lines inside the newly created file
        storePassword=<password from previous step>
        keyPassword=<password from previous step>
        storeFile=<location of the key store file, such as /Users/<user name>/key.jks>
  • Keep the file private; do not check it into public source control.
  • Always keep a backup of the file.

step 3 : Configure signing in gradle

Navigate to /android/app/build.gradle file.

1. Replace the following
android {
   def keystoreProperties = new Properties()
   def keystorePropertiesFile = rootProject.file('')
   if (keystorePropertiesFile.exists()) {
       keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

   android {
2. Replace the following
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
with the signing config info
signingConfigs {
       release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile file(keystoreProperties['storeFile'])
           storePassword keystoreProperties['storePassword']
   buildTypes {
       release {
           signingConfig signingConfigs.release
Now, every release build of your app will be signed automatically

step 4 : how to create APK file or Android App Bundle using flutter ?

  • How to build an android app bundle (aab) using flutter ?

Running flutter build defaults to a release build

flutter build appbundle
Note : release bundle for your app is created at /build/app/outputs/bundle/release/app.aab
  • How to build apk file using flutter ?
flutter build apk 
Note : the above command "flutter build apk" builds a fat apk

flutter build apk --split-per-abi 
Note : the above command generated two apk files 
  • armeabi-v7a (32-bit) apk 
  • arm64-v8a (64-bit) apk

Bonus Tip : Do not forget to :

  • Add a launcher icon to you app - refer our icon guide - android app icon
  • Review App Manifest File, AndroidManifest.xml, located in <app dir>/android/app/src/main
    • Application Name [android : label in <application> tag]
    • uses-permission [Permission requested by your app]
  • Review the build configuration, Gradle build file, build.gradle, located in <app dir>/android/app
    • Navigate to defaultConfig code block and verify 
      • applicationId - unique app id
      • versionCode & versionName - Setting the version property in pubspec.yaml
      • minSdkVersion & targetSdkVersion - API level on which your app is designed to run

Useful Resources

Flutter Official Docs - Deployment Guide

To learn more about flutter - Flutter Developer Guide

Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited.The materials(images, logos, content) contained in this web site are protected by applicable copyright and trade mark law.

Flutter, Android and the Android logo are registered trademarks of Google LLC.

Popular posts from this blog

Step-by-Step Guide to create a new flutter project using Visual Studio Code [VS Code]

This is a beginner's guide to visual studio code and flutter. VS Code is a light weight editor with flutter app development, execution and debug support. Visual Studio Code is a source-code editor developed by Microsoft. Install latest stable version of VS Code Install the Flutter and Dart plugins In VS Code "Extensions" Tab, search field type flutter, select "Flutter" in the list and click "Install". Flutter plugin also installs the required Dart plugin. Validate your flutter setup using "flutter doctor command". Once Flutter SDK and your VS Code Editor is up and running, Flutter Visual Studio Code To Create a new flutter project from the flutter starter app template follow the below steps step 1 : Open Command Palette Use Shortcut key - Ctrl+Shift+P or Cmd+Shift+P on macOS OR Go to View Menu, select "Command Palette" VS Code Command Palette step 2 : Create Flutter New Project Sele

Step-by-Step Guide to take a App Screenshot with the Device Frame using Android Studio

This guide will help you to take a screenshot with the device frame using android studio. If we capture screenshot using the default android emulator "Capture Screenshot" option, then screenshot will not have the device frame. Android Emulator - Screen Capture By using android studio we can capture screenshot with different devices frame. How to take a App Screenshot with the Device Frame using Android Studio step 1 : Load your project in android studio and run the app Open Android Studio Load your android app project in android studio.  Build and Run your app using android emulator or a connected physical device.  If you are using a physical device make sure that you have enabled USB DEBUGGING option. Android Studio - Load Project step 2 : Open Logcat in Android Studio Check out bottom left corner in android studio to find Logcat option and click to open Logcat If it is not visible then select "View Menu" and search for