Splits

DSL object for configuring APK Splits options. Configuring this object allows you to build Multiple APKs and Configuration APKs.

If your app targets multiple device configurations, such as different screen densities and Application Binary Interfaces (ABIs), you might want to avoid packaging resources for all configurations into a single large APK. To reduce download sizes for your users, the Android plugin and Google Play Store provide the following strategies to generate and serve build artifiacts that each target a different device configuration--so users download only the resources they need:

  • Multiple APKs: use this to generate multiple stand-alone APKs. Each APK contains the code and resources required for a given device configuration. The Android plugin and Google Play Store support generating multiple APKs based on screen density and ABI. Because each APK represents a standalone APK that you upload to the Google Play Store, make sure you appropriately assign version codes to each APK so that you are able to manage updates later.
  • Configuration APKs: use this only if you're building Android Instant Apps. The Android plugin packages your app's device-agnostic code and resources in a base APK, and each set of device-dependent binaries and resources in separate APKs, called configuration APKs. Configuration APKs do not represent stand-alone versions of your app. That is, devices need to download both the base APK and additional configuration APKs from the Google Play Store to run your instant app. The Android plugin and Google Play Store support generating configuration APKs based on screen density, ABI, and language locales. You specify properties in this block just as you would when building multiple APKs. However, you need to also set generatePureSplits to true.

Properties

PropertyDescription
abi

Encapsulates settings for building per-ABI APKs.

abiFilters

The list of ABIs that the plugin will generate separate APKs for.

density

Encapsulates settings for building per-density APKs.

densityFilters

The list of screen density configurations that the plugin will generate separate APKs for.

language

Encapsulates settings for building per-language (or locale) APKs.

languageFilters

The list of languages (or locales) that the plugin will generate separate APKs for.

Methods

No methods

Script blocks

BlockDescription
abi

Encapsulates settings for building per-ABI APKs.

density

Encapsulates settings for building per-density APKs.

language

Encapsulates settings for building per-language (or locale) APKs.

Property details

Encapsulates settings for building per-ABI APKs.

Set<String> abiFilters

The list of ABIs that the plugin will generate separate APKs for.

If this property returns null, it means the plugin will not generate separate per-ABI APKs. That is, each APK will include binaries for all ABIs your project supports.

Encapsulates settings for building per-density APKs.

Set<String> densityFilters

The list of screen density configurations that the plugin will generate separate APKs for.

If this property returns null, it means the plugin will not generate separate per-density APKs. That is, each APK will include resources for all screen density configurations your project supports.

Encapsulates settings for building per-language (or locale) APKs.

Note: Building per-language APKs is supported only when building configuration APKs for Android Instant Apps.

Set<String> languageFilters

The list of languages (or locales) that the plugin will generate separate APKs for.

If this property returns null, it means the plugin will not generate separate per-language APKs. That is, each APK will include resources for all languages your project supports.

Script block details

abi { }

Encapsulates settings for building per-ABI APKs.

For more information about the properties you can configure in this block, see AbiSplitOptions.

Delegates to:
AbiSplitOptions from abi

density { }

Encapsulates settings for building per-density APKs.

For more information about the properties you can configure in this block, see DensitySplitOptions.

Delegates to:
DensitySplitOptions from density

language { }

Encapsulates settings for building per-language (or locale) APKs.

Note: Building per-language APKs is supported only when building configuration APKs for Android Instant Apps.

For more information about the properties you can configure in this block, see LanguageSplitOptions.

Delegates to:
LanguageSplitOptions from language