Splits

public interface Splits


Options to configure Multiple APKs.

android.splits

If you publish your app to Google Play, you should build and upload an Android App Bundle. When you do so, Google Play automatically generates and serves optimized APKs for each user’s device configuration, so they download only the code and resources they need to run your app. This is much simpler than managing multiple APKs manually.

If you publish your app to a store that doesn't support the Android App Bundle format, you can publish multiple APKs manually.

The Android Gradle plugin supports generating multiple APKs based on screen density and Application Binary Interface (ABI), where each APK contains the code and resources required for a given device configuration.

You will also need to assign version codes to each APK so that you are able to manage updates later.

Previously the Android Gradle plugin also supported building 'Configuration APKs' for Instant Apps using this splits block, but that has been superseded by the Android App Bundle format.

Summary

Public methods

abstract void
abi(
    @ExtensionFunctionType @NonNull Function1<@NonNull AbiSplitUnit> action
)

Encapsulates settings for building per-ABI APKs.

abstract void

Encapsulates settings for building per-density APKs.

abstract @NonNull AbiSplit

Encapsulates settings for building per-ABI APKs.

abstract @NonNull Collection<@NonNull String>

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

abstract @NonNull DensitySplit

Encapsulates settings for building per-density APKs.

abstract @NonNull Collection<@NonNull String>

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

Public methods

abi

abstract void abi(
    @ExtensionFunctionType @NonNull Function1<@NonNull AbiSplitUnit> action
)

Encapsulates settings for building per-ABI APKs.

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

density

abstract void density(
    @ExtensionFunctionType @NonNull Function1<@NonNull DensitySplitUnit> action
)

Encapsulates settings for building per-density APKs.

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

getAbi

abstract @NonNull AbiSplit getAbi()

Encapsulates settings for building per-ABI APKs.

getAbiFilters

abstract @NonNull Collection<@NonNull StringgetAbiFilters()

Returns 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.

Returns
@NonNull Collection<@NonNull String>

a set of ABIs.

getDensity

abstract @NonNull DensitySplit getDensity()

Encapsulates settings for building per-density APKs.

getDensityFilters

abstract @NonNull Collection<@NonNull StringgetDensityFilters()

Returns 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.

Returns
@NonNull Collection<@NonNull String>

a set of screen density configurations.