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
totrue
.
Property | Description |
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. |
Block | Description |
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. |
AbiSplitOptions
abi
Encapsulates settings for building per-ABI APKs.
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.
DensitySplitOptions
density
Encapsulates settings for building per-density APKs.
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.
LanguageSplitOptions
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.
Encapsulates settings for building per-ABI APKs.
For more information about the properties you can configure in this block, see AbiSplitOptions
.
- Delegates to:
AbiSplitOptions
fromabi
Encapsulates settings for building per-density APKs.
For more information about the properties you can configure in this block, see DensitySplitOptions
.
- Delegates to:
DensitySplitOptions
fromdensity
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
fromlanguage