Mega Bundle SALE is ON! Get ALL of our amazing Flutter codebases with 75% OFF discount ūüĒ•

When it comes to signing a mobile app and building the release version of a mobile app, we need to dive into the whole process. Sometimes it seems that coding the application is much easier than releasing the app in the Google Play Store or App Store. Especially on Flutter. Generating the Flutter Release APK for Android might seem a little tedious at first, so we are covering the process step by step in this Flutter tutorial.

generate flutter release apk build

In this article, we are going to deal with every step necessary to create a release build APK of a Flutter app for Android. All the steps areas in the official documentation might be updated as days roll on.

Let’s get started!

1. Generating Keystore

An app requires a digital signature before being uploaded to its respective stores. The signature can be applied by using the Keystore (a .jks file). This Keystore file is not readily available out of box. Hence, we need to generate it using the keytool command. Once you generate this file and use it to sign your APK, you should store it in a safe location so that you won’t ever lose it. You will have to use the same key next time you upload your updated build to the Play Store.

Google Play Store will use the digital signature to verify the authenticity of the upload build. To generate the Keystore file, we need to run the keytool command. This command will save the Keystore file in the C:/Users/<your_local_system_name> path (if on Windows) or in the current directory (on UNIX).

For Mac/Linux, we need to run the following command to generate your keystore:

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

For Windows

keytool -genkey -v -keystore C:/Users/**<your_local_system_name>**/keystore.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias flutter

2. Creating Keystore Properties

Now that we have the Keystore file to sign our release build, we need to formulate a file with Keystore properties so that the properties of Keystore can be easily accessed by the native code in the Android project. Hence, we need to create a file called in the ./android folder of the Flutter project.

Inside the file, we need to add the following properties:


3. Updating build.gradle

The third step is to make some configuration changes in our ./android/app/build.gradle file. Make sure that we have the following configurations added to the build.gradle file:

In the file, inside defaultConfig object, we need to replace the buildTypes block with the code provided in the code snippet below:

signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
    buildTypes {
        release {
            signingConfig signingConfigs.release

Here, we added the signingConfigs object with release key properties from the file. Also, replaced the debug configurations inside the buildTypes from debug to release.

Now, we need to add code in the following code snippet just before the android { block :

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

4. Making Last Minute Polishes

Now, if there is any package or library installed in the Flutter project that requires an update then this is the right time to do it. We need to check every library to install the latest version and make configurations accordingly. We need to test the app fully if everything works properly after the updates.

5. Generating the Flutter Release APK Build (.aab file)

Now, we are ready to bundle up our app assets and resources and create a release version of the Flutter app. First, we need to run the following command to clean out any other previous build and configurations:

flutter clean

Then, in order to build the release version of the app, we need to run the following command:

flutter build appbundle --release

This may take some time as all the resources are bundled up to generate the .aab file. After the successful build, you will find the the release bundle for your app at ./<app-dir>/build/app/outputs/bundle/release/<app_name>.aab.

Now, the available release build is ready to be uploaded to the Google Play Store.


The main objective of this tutorial was to demonstrate the process to generate the release build APK for a Flutter application for Android. All the steps are easier to follow in regards to creating a release build.

However, one of the main hurdles is updating the 3rd party Flutter packages, since you need to make sure that each feature of the app runs properly. A recursive test must be applied to the app. After everything works as expected, then we can create a release build. We need to make sure that each and every configuration step is properly followed. Otherwise, an error may occur while building the process or the Google Play Store may not accept the created artifact file.

This is how you generate the release build APK for Android in Flutter apps. We’ll cover the iOS process in a separate tutorial. Stay tuned!

Categories: Flutter Tutorials


Flutter Developer @Chingmai Love Building Fastest App

Leave a Reply

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

Shopping Cart