I've successfully implemented APK Splits so that separate APKs are generated for different ABIs.
However, for efficiency (and since I have no need for non-armeabi-v7a APKs in Debug), I would like to limit Debug builds to only generate armeabi-v7a APKs.
How can this be done?
One idea is with this:
abi {
enable true
reset()
include 'x86', 'armeabi-v7a', 'mips'
universalApk false
}
Maybe there is some way to set enable
based on the Build type?
I'm a bit late to this party, but having a problem with different flavors and tasks names, I've come with this:
It's just a small update to Jeff P's answer but works well with different flavors and build configurations.
Update for @Jeff P's answer to make it more flexible based on app name and to support Android App Bundle (.aab) format
You can try a variation on @Geralt_Encore's answer, which avoids the separate
gradlew
command. In my case, I only cared to use APK splitting to reduce the released APK file size, and I wanted to do this entirely within Android Studio.From what I've seen, the Build | Generate Signed APK menu item in Android Studio generates the APK using the
assembleRelease
Gradle target.You can set
enable
based on command line argument. I have solved kinda similar problem when I wanted to use splits only for the release version, but not for regular debug builds.And then
./gradlew -PsplitApks assembleProdRelease
(prod is a flavor in my case).