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?
Major differences are the debug apk and the release apk: For debug builds the apk will be signed with the default debug signing keys with debug flag enabled. For release apk you will have to explicitly specify the apk to sign with and the debug flag will be turned off so that it cannot be debugged.
SAI (Split APKs Installer) is an App that lets you install multiple APKs as if it was a single Package.
Click on the package name, and in the top right of the Devices view you should see a green bug along with a number of other small buttons. Click the green bug. You should now be attached/debugging your app.
A signed, universal APK is a single, installable APK that is signed with the same app signing key used by Play App Signing for your app. You can distribute this APK on other app stores and distribution channels such as websites so that wherever you distribute your app, it's signed with the same key.
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.
splits { abi { enable gradle.startParameter.taskNames.any { it.contains("Release") } reset() include 'x86', 'armeabi-v7a', 'mips' universalApk false } }
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.
splits { abi { enable project.hasProperty('splitApks') reset() include 'x86', 'armeabi-v7a' } }
And then ./gradlew -PsplitApks assembleProdRelease
(prod is a flavor in my case).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With