

You only need to add -split-per-abi flag and Flutter will generate multiple APK files, each for a specific platform. It becomes very big in order to support those different instruction sets.įortunately, Flutter already provides an easy way to split the APK files per ABIs.

But that causes a problem regarding the build size of the APK. By default, Flutter only generates an APK that works for all platforms. Those different CPUs support different instruction sets. In addition, old devices use 32-bit CPUs, while the majority of devices released in recent years already use 64-bit CPUs. A large portion of devices uses ARM-based CPUs, while some devices use Intel x86 CPUs. The example below changes the entry-point to lib/home.dartįlutter build apk -target=lib/home.dart Split per ABI and Set Target PlatformsĪndroid devices use various CPUs. If you want to change that, you can pass -target= flag. By default, lib/main.dart is set to be the main entry-point. That's the first file to be run when the application is launched (similar to MainActivity in Android). flutter build apk -profile Set Main Entry-Point FileĪ Flutter application has a file as the main entry-point. flutter build apk -debug Build Profile APKįor profile mode, you need to add -profile flag.

flutter build apk -release Build Debug APKįor debug mode, you need to add -debug flag. The above command is the same as the below command which explicitly uses release mode. Set Mode Build Release APKīy default, if not specified, the generated APK files use release mode. This includes how to set the mode (release, debug, or profile), set the main entry point, split per ABI, set target platforms, set the build name and version, build flavor APK, and obfuscate the code. In this tutorial, I am going to show you how to build APK files for Android using Flutter. If the application is developed using Flutter, you can easily build APK files by using flutter build apk command. After you build an application, it's quite common to build APK files to be tested across different devices. This tutorial shows you how to build APK files for Android for applications developed using Flutter.ĪPK (Application Package File) is a format used by Android operating systems for distribution and installation.
