Updated 15 January 2018
Generally, we build a single APK to support all your target devices whenever possible, that might result in a very large APK due to files needed to support multiple screen density and Application Binary Interface (ABIs). But we can create multiple apks file that contains files for specific density or ABIs.
To configure your build for multiple APKs, add a splits block to your module-level build.gradle file. Within the splits block, provide a density block that specifies how Gradle should generate per-density APKs, or an abi block that specifies how Gradle should generate per-ABI APKs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
android { ... splits { // Configures multiple APKs based on screen density. density { // Configures multiple APKs based on screen density. enable true // Specifies a list of screen densities Gradle should not create multiple APKs for. exclude "ldpi", "xxhdpi", "xxxhdpi" // Specifies a list of compatible screen size settings for the manifest. compatibleScreens 'small', 'normal', 'large', 'xlarge' } } } |
To create separate APKs for different ABIs, add an abi block inside your splits block. In your abi block, provide a list of desired ABIs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
android { ... splits { // Configures multiple APKs based on ABI. abi { // Enables building multiple APKs per ABI. enable true // By default all ABIs are included, so use reset() and include to specify that we only // want APKs for x86, armeabi-v7a, and mips. // Resets the list of ABIs that Gradle should create APKs for to none. reset() // Specifies a list of ABIs that Gradle should create APKs for. include "x86", "armeabi-v7a", "mips" // Specifies that we do not want to also generate a universal APK that includes all ABIs. universalApk false } } } |
Ref:->https://developer.android.com/studio/build/configure-apk-splits.html#configure-split
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.