我正在使用gradle和split生成android apks。
以下是我使用的示例:
splits {
density {
enable true
reset()
include "mdpi", "hdpi"
}
abi {
enable true
reset()
include "x86", "arm64-v8"
}
}
根据文档,它应生成4个apks mdpi-x86,mdpi-arm64-v8,hdpi-x86和hpdi-arm64-v8。
但是,当我运行gradle脚本时,会生成6个apk,上面的四个和另外两个:x86.apk和arm64-v8.apk。我不确定为什么会产生这些,原因是什么。有没有一种方法不产生那些?
最佳答案
当按密度划分时,Android插件将始终为(至少到目前为止)不支持屏幕密度的设备生成一个“附加” APK。
根据他们的documentation:
Because each APK that's based on screen density includes a tag with specific restrictions about which screen types the APK supports, even if you publish several APKs, some new devices will not match your multiple APK filters. As such, Gradle always generates an additional universal APK that contains assets for all screen densities and does not include a tag. You should publish this universal APK along with your per-density APKs to provide a fallback for devices that do not match the APKs with a tag.
在您的情况下,因为您也要按ABI进行拆分,所以您会得到两个“附加” APK,而不仅仅是一个。
关于android - Gradle 密度abi apks,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50053437/