Build overview

AOSP uses the Soong build system to build Android. Soong uses the kati GNU Make clone tool and Ninja build system component to speed up builds of Android.

Soong build files are called blueprint files and are named Android.bp. These files are similar in syntax and semantics to Bazel BUILD files.

For more information about the Android.bp file format, see Android.bp file format.

For more information about converting Make files to Android.bp files, see Make and Soong comparison.

Feature launch flags and build flags

Feature launch flags are binary flags used to isolate untested code from tested code. If you maintain your own mirror of the AOSP external development branch, you can use these flags to keep your mirrored code stable. If you're contributing code to the public external development branch, your reviewer might ask you to implement a flag for your code.

Build flags are build-time string constants used to modify your build, such as optionally including a code library.

For more information about the different code branches, see Release lifecycle.

Feature launch flags and build flags require changes to build files. For more information about these flags and how to use them in a build, see Feature launch flags overview.

Code and resource shrinking with R8

Soong uses the R8 compiler to shrink and optimize Java and Kotlin targets that compile DEX bytecode, such as android_app, android_test, and installable java_library modules. On static libraries, such as android_library and static java_library, the optimize block attaches and exports consumer keep rules.

For more information about configuring R8 optimization and keep rules, see Optimize platform code and resources with R8.