Stay organized with collections
Save and categorize content based on your preferences.
Splits
@Incubating 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 functions
Public properties
abiFilters
val abiFilters: Collection<String>
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.
densityFilters
val densityFilters: Collection<String>
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.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Splits\n======\n\n\n```\n@Incubating interface Splits\n```\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nOptions to configure Multiple APKs.\n\n[`android`](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/ApplicationExtension#splits(kotlin.Function1))`.`[`splits`](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/Splits)\n\nIf you publish your app to Google Play, you should build and upload an [Android App Bundle](https://developer.android.com/guide/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.\n\nIf you publish your app to a store that doesn't support the Android App Bundle format, you can publish [multiple APKs](https://developer.android.com/studio/build/configure-apk-splits.html) manually.\n\nThe Android Gradle plugin supports generating multiple APKs based on screen density and [Application Binary Interface (ABI)](https://developer.android.com/ndk/guides/abis.html), where each APK contains the code and resources required for a given device configuration.\n\nYou will also need to [assign version codes to each APK](https://developer.android.com/studio/build/configure-apk-splits.html#configure-APK-versions) so that you are able to manage updates later.\n\nPreviously 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.\n\nSummary\n-------\n\n| ### Public functions ||\n|------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [abi](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/Splits#abi(kotlin.Function1))`(action: (@`[ExtensionFunctionType](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html)` `[AbiSplit](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/AbiSplit)`.() `-\u003e` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)?)` Encapsulates settings for [building per-ABI APKs](https://developer.android.com/studio/build/configure-apk-splits.html#configure-abi-split). |\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [density](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/Splits#density(kotlin.Function1))`(action: (@`[ExtensionFunctionType](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html)` `[DensitySplit](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/DensitySplit)`.() `-\u003e` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)?)` Encapsulates settings for [building per-density APKs](https://developer.android.com/studio/build/configure-apk-splits.html#configure-density-split). |\n\n| ### Public properties ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [AbiSplit](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/AbiSplit) | [abi](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/Splits#abi()) Encapsulates settings for [building per-ABI APKs](https://developer.android.com/studio/build/configure-apk-splits.html#configure-abi-split). |\n| [Collection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html)`\u003c`[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`\u003e` | [abiFilters](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/Splits#abiFilters()) Returns the list of ABIs that the plugin will generate separate APKs for. |\n| [DensitySplit](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/DensitySplit) | [density](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/Splits#density()) Encapsulates settings for [building per-density APKs](https://developer.android.com/studio/build/configure-apk-splits.html#configure-density-split). |\n| [Collection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html)`\u003c`[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`\u003e` | [densityFilters](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/Splits#densityFilters()) Returns the list of screen density configurations that the plugin will generate separate APKs for. |\n\nPublic functions\n----------------\n\n### abi\n\n```\nfun abi(action: (@ExtensionFunctionType AbiSplit.() -\u003e Unit)?): Unit\n```\n\nEncapsulates settings for [building per-ABI APKs](https://developer.android.com/studio/build/configure-apk-splits.html#configure-abi-split).\n\nFor more information about the properties you can configure in this block, see [AbiSplit](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/AbiSplit). \n\n### density\n\n```\nfun density(action: (@ExtensionFunctionType DensitySplit.() -\u003e Unit)?): Unit\n```\n\nEncapsulates settings for [building per-density APKs](https://developer.android.com/studio/build/configure-apk-splits.html#configure-density-split).\n\nFor more information about the properties you can configure in this block, see [DensitySplit](/reference/tools/gradle-api/7.2/com/android/build/api/dsl/DensitySplit).\n\nPublic properties\n-----------------\n\n### abi\n\n```\nval abi: AbiSplit\n```\n\nEncapsulates settings for [building per-ABI APKs](https://developer.android.com/studio/build/configure-apk-splits.html#configure-abi-split). \n\n### abiFilters\n\n```\nval abiFilters: Collection\u003cString\u003e\n```\n\nReturns the list of ABIs that the plugin will generate separate APKs for.\n\nIf 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. \n\n| Returns ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|\n| [Collection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html)`\u003c`[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`\u003e` | a set of ABIs. |\n\n### density\n\n```\nval density: DensitySplit\n```\n\nEncapsulates settings for [building per-density APKs](https://developer.android.com/studio/build/configure-apk-splits.html#configure-density-split). \n\n### densityFilters\n\n```\nval densityFilters: Collection\u003cString\u003e\n```\n\nReturns the list of screen density configurations that the plugin will generate separate APKs for.\n\nIf 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. \n\n| Returns ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------|\n| [Collection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html)`\u003c`[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`\u003e` | a set of screen density configurations. |"]]