Skip to main content

APK

This command builds your Flutter application as an Android APK file for installation on devices or distribution outside of the Play Store.

morpheme build apk

Description​

The apk command compiles your Flutter app into an Android Package (APK) file. By default, it builds a release version with the dev flavor.

After building, the APK file will be located in:

  • build/app/outputs/apk/
  • build/app/outputs/flutter-apk/

Usage​

Basic Build (Dev, Release)​

morpheme build apk

Build for Production​

morpheme build apk --flavor prod --release

Build with Obfuscation​

Obfuscate code to protect against reverse engineering (recommended for production).

morpheme build apk --flavor prod --release --obfuscate

Build with Custom Version​

morpheme build apk --build-number 42 --build-name "1.2.0"

Debug Build​

morpheme build apk --flavor dev --debug

Options​

morpheme build apk [options]

To see all available options and flags, run morpheme build apk --help.

Available Options​

OptionAbbrDescription
--flavor [env]-fBuild flavor (dev, stag, prod). Default: dev.
--debugBuild in debug mode.
--profileBuild in profile mode.
--releaseBuild in release mode (default).
--target [path]-tMain Dart entry file. Default: lib/main.dart.
--build-number [number]Override the build number (e.g., 42).
--build-name [version]Override the build name/version (e.g., 1.2.0).
--[no-]obfuscateEnable code obfuscation (requires --split-debug-info). Default: true in release.
--split-debug-info [dir]Store debug symbols separately. Default: ./.symbols/.
--[no-]l10nGenerate localization files before building. Default: true.
--morpheme-yaml [path]Path to a custom configuration file.
tip

For production builds, always use --flavor prod --release --obfuscate to ensure optimal performance and security.