android - Gradle 密度abi apks

标签 android gradle android-gradle-plugin

我正在使用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/

相关文章:

java - 无法从 Activity 到 fragment 获取 bundle 值

Android-NDK "java.lang.UnsatisfiedLinkError"

spring-boot - 为什么Intellij无法在Spring Boot Starter项目中识别Gradle?

java - Gradle:无法获取类型 'EclipseProject' 的模型

android - ionic cordova构建Android失败

android - gradle-android-scala-plugin 给出 "Could not find matching constructor"错误

android - ScrollView 和 ListView 的区别

android - list 合并失败 : uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com. google.firebase :firebase-iid:19. 0.0]

android-studio - 更新后的 Android studio 3.0 Canary NPE

android - 设置图片边框突然出现问题