Paramclasses Academy - Blog

Tutorials Details

←
Post 37 of 40
→

How to Build an Android APK and App Bundle with Flutter | Complete Guide

How to Build an Android APK and App Bundle with Flutter | Complete Guide

November 3, 2026

❖ Welcome to Param Classes!

✦ Introduction

After developing a Flutter application, the next important step is to create an installable Android application file.

If you want to install your app on an Android phone, share it with someone or prepare it for publishing on the Google Play Store, you need to understand how to generate a release build.

Flutter supports two important Android release formats:

  1. APK (Android Package Kit): An installable Android application file that can be shared and installed on compatible Android devices.

  2. AAB (Android App Bundle): A publishing format used by Google Play to generate optimized APKs for users' devices.

In this tutorial by Param Classes, we will learn how to build APK and AAB files using Flutter, understand release signing and locate the generated files.

✦ 1. What Is an APK File?

APK stands for Android Package Kit.

It is the file format used to distribute and install Android applications.

For example, after developing a Flutter shopping application, you can generate an APK file and transfer it to an Android phone for installation.

Important features of APK:

  • Can be installed directly on compatible Android devices.

  • Can be shared for testing and distribution.

  • Supports release builds.

  • Can be generated using Flutter commands.

An APK is useful when you want to distribute an application directly or test a release build.

✦ 2. What Is an Android App Bundle (AAB)?

AAB stands for Android App Bundle.

It is a publishing format designed to help Google Play generate optimized APKs for different devices.

Instead of uploading separate APK files for different device configurations, developers upload one AAB file to Google Play.

Benefits of AAB:

  • Supports optimized application delivery.

  • Helps Google Play generate device-specific APKs.

  • Supports modern Android app publishing workflows.

  • Is the recommended format for new Google Play app uploads.

APK vs AAB

Feature APK AAB
Full Form Android Package Kit Android App Bundle
Direct Installation Yes No, not directly
Sharing Easy to share Mainly for store publishing
Google Play Publishing Supported in applicable workflows Recommended
Device Optimization Generally distributed as built Google Play generates optimized APKs

✦ 3. Prepare Your Flutter Project

Before generating an APK or AAB, make sure your Flutter project is working correctly.

Open your project in Android Studio or VS Code.

Run the following commands:

flutter doctor

This checks your Flutter development environment.

Next, download the project dependencies:

flutter pub get

Check whether your application has errors:

flutter analyze

Finally, run the application on an emulator or real Android device:

flutter run

Fix important errors before creating the release build.

✦ 4. Update Your Application Name and Package ID

Before releasing an application, configure its identity.

The Android application ID uniquely identifies your application on Google Play.

Open:

android/app/build.gradle.kts

For projects using Kotlin DSL, you may find configuration similar to this:

android {
    namespace = "com.example.myapp"

    defaultConfig {
        applicationId = "com.example.myapp"
    }
}

For older projects using Groovy, the file may be named build.gradle and use a different syntax.

Example:

defaultConfig {
    applicationId "com.example.myapp"
}

Replace the example ID with your own unique application ID before publishing.

For example:

com.paramclasses.studentapp

Choose the application ID carefully because changing it after publishing creates a different application identity on Google Play.

You should also configure the application name displayed on the Android device.

Open:

android/app/src/main/AndroidManifest.xml

Check the application label configuration and update it if necessary.

✦ 5. Build a Release APK Using Flutter

Now let's generate an Android APK.

Open the terminal in your Flutter project root directory.

Run:

flutter build apk --release

Flutter will compile the application and generate a release APK.

After successful compilation, you can find the file here:

build/app/outputs/flutter-apk/app-release.apk

This is your release APK.

You can transfer this file to a compatible Android phone and install it, provided the device allows installation from that source.

Build a Smaller APK Using Split Per ABI

You can also generate separate APK files for different Android processor architectures.

Run:

flutter build apk --split-per-abi

Flutter generates separate APK files for supported ABIs, such as:

  • ARM 64-bit

  • ARM 32-bit

  • x86 64-bit

The output files are generally stored in:

build/app/outputs/flutter-apk/

This approach can reduce the download size for users who install the APK matching their device architecture.

✦ 6. Build an Android App Bundle (AAB)

If you want to publish your Flutter application on Google Play, you will generally use an Android App Bundle.

Run this command:

flutter build appbundle --release

After successful compilation, the AAB file is generated at:

build/app/outputs/bundle/release/app-release.aab

This file can be uploaded to the appropriate Google Play Console release track.

Remember: an AAB is not a directly installable APK. Google Play uses it to generate APKs for users' devices.

✦ 7. Configure Android App Signing

Release applications need to be signed.

Android signing helps identify the developer or organization responsible for an application and allows Android to verify application updates.

For a production release, you should create and securely protect a release signing key.

Step 1: Generate a Keystore

On a computer with Java's keytool available, run:

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

Follow the prompts to set a keystore password and key information.

Keep the generated upload-keystore.jks file safe.

Step 2: Create a key.properties File

Create a file named:

android/key.properties

Add:

storePassword=YOUR_STORE_PASSWORD
keyPassword=YOUR_KEY_PASSWORD
keyAlias=upload
storeFile=../upload-keystore.jks

Replace the example password values with your actual credentials.

The path in storeFile must match the location of your keystore file.

Step 3: Protect Your Signing Information

Do not upload your keystore or passwords to a public Git repository.

Add the following entries to your .gitignore file:

android/key.properties
*.jks
*.keystore

Keep secure backups of your signing credentials.

Step 4: Configure Release Signing

The exact Gradle configuration depends on whether your project uses Groovy or Kotlin DSL.

In the Android Gradle configuration, load the values from key.properties, create a signing configuration and assign it to the release build type.

For a Kotlin DSL project, the configuration follows this general pattern:

import java.util.Properties
import java.io.FileInputStream

val 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 {
        release {
            signingConfig = signingConfigs.getByName("release")
        }
    }
}

This is an example for a Kotlin DSL Gradle file. Make sure the file path and existing project configuration are correct before applying it.

For new Google Play applications, Google Play App Signing is generally used. The upload key signs the bundle you submit, while Google Play manages the app-signing key used for distributed APKs.

✦ 8. Build the Signed Release APK and AAB

After configuring release signing, you can generate signed release files.

Generate APK:

flutter build apk --release

Generate AAB:

flutter build appbundle --release

Check the build output for errors.

If the build completes successfully, your release files will be available in their respective output folders.

✦ 9. Test Your Release APK

Before sharing your application, install and test the release APK.

You can connect an Android phone using USB debugging and install the APK through ADB:

adb install -r build/app/outputs/flutter-apk/app-release.apk

The -r option reinstalls the application while attempting to preserve its data.

Test important features such as:

  • Application launch.

  • Login and registration.

  • API connectivity.

  • Navigation between screens.

  • Image loading.

  • Form validation.

  • Database operations.

  • Notifications and permissions.

A release build may behave differently from a debug build, so always test it before distribution.

✦ 10. Common APK and AAB Build Errors

1. Gradle Build Failed

Check the complete error message, Android Gradle Plugin compatibility and Java configuration.

Try:

flutter clean
flutter pub get
flutter build apk --release

2. Missing Dependencies

Run:

flutter pub get

Check the dependency versions in pubspec.yaml.

3. Keystore File Not Found

Check the storeFile path inside key.properties. Make sure the keystore file exists at that location.

4. Incorrect Password

Verify the keystore password, key password and alias.

5. Application ID Problems

Check that the application ID is correctly configured and meets Android package naming requirements.

6. Insufficient Storage

Make sure your computer has enough free disk space for the build process.

✦ 11. Important Flutter Build Commands

Command Purpose
flutter doctor Check Flutter environment
flutter pub get Download dependencies
flutter analyze Analyze source code
flutter clean Remove generated build files
flutter build apk --release Generate release APK
flutter build apk --split-per-abi Generate architecture-specific APKs
flutter build appbundle --release Generate release AAB
flutter devices List connected devices

✦ Conclusion

Generating APK and AAB files is an important step in Flutter app development. APK files are useful for direct installation and testing, while AAB files are the recommended publishing format for new Google Play applications.

By learning release builds, application IDs, signing configurations and testing procedures, you can prepare your Flutter applications for distribution.

At Param Classes, we believe in practical learning that helps students understand the complete application development process—from writing Dart code to preparing Android release files.

Practice these commands with your own Flutter project and learn how to create a properly signed release build.

Learn Today, Grow Tomorrow with Param Classes!

←
Post 37 of 40
→