Now we can also use api splits http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
Example From the docs link :
android {
...
splits {
density {
enable true
exclude "ldpi", "tvdpi", "xxxhdpi"
compatibleScreens 'small', 'normal', 'large', 'xlarge'
}
}
- enable: enables the density split mechanism
- exclude: By default all densities are included, you can remove some densities.
- include: indicate which densities to be included
- reset(): reset the list of densities to be included to an empty string (this allows, in conjunctions with include, to indicate which one to use rather than which ones to ignore)
- compatibleScreens: indicates a list of compatible screens. This will inject a matching node in the manifest. This is optional.
Example in AOSP: https://android.googlesource.com/platform/tools/base/+/2101d189d85dd46f865726b9b7aa0012832a6d9c/build-system/tests/regular/densitySplit/build.gradle