Open In App

How to Build and Release Flutter Application in Android Device?

Last Updated : 30 Mar, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Flutter is Google’s Mobile SDK to build native iOS and Android, Desktop (Windows, Linux, macOS), Web apps from a single codebase. When building applications with Flutter everything towards Widgets – the blocks with which the flutter apps are built. They are structural elements that ship with a bunch of material design-specific functionalities and new widgets can be composed out of existing ones too. The process of composing widgets together is called composition. In this article, we are going to learn How to Build and Release a Flutter Application on Android Device. We have 2 potential release formats once the app is ready for publication to the Play Store.

  1. App Bundle
  2. APK

Build App Bundle

From the command line:

  • Open the git bash.
  • Enter cd [project_name]
  • Run flutter build appbundle
(Running flutter build defaults to a release build.)

Running flutter build defaults to a release build

The release bundle for your app is created in the project directory-  [project_name]/build/app/outputs/bundle/release/app.aab. By default, the app bundle contains your Dart code and the Flutter runtime compiled for armeabi-v7a (ARM 32-bit), arm64-v8a (ARM 64-bit), and x86-64 (x86 64-bit).

Build APK

From the command line:

  • Open git bash
  • Enter cd [project_name]
  • Run flutter build apk –split-per-abi
Build APK

The flutter build command defaults to –release

This command results in three APK files in the project directory:

[project]/build/app/outputs/apk/release/app-armeabi-v7a-release.apk

[project]/build/app/outputs/apk/release/app-arm64-v8a-release.apk

[project]/build/app/outputs/apk/release/app-x86_64-release.apk

Removing the –split-per-abi flag results in a fat APK that contains your code compiled for all the target ABIs. Such APKs are larger in size than their split counterparts, causing the user to download native binaries that are not applicable to their device’s architecture.

Install an APK on a device

Follow these steps to install the APK on a connected Android device. From the command line connect your Android device to your computer with a USB cable.

  • Enter cd [project]
  • Run flutter install

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads