【问题标题】:is there any way to exclude xxxhdpi resources when building an apk构建apk时有什么方法可以排除xxxhdpi资源
【发布时间】:2020-11-23 13:35:15
【问题描述】:

我的问题是 xxxhdpi 文件夹中的资源占用了很多存储空间,使得最终的 apk 变得不必要的大

在构建调试 apk 时尤其如此

对于不同的abis,我们可以使用abifilters,资源有没有类似的东西?

拆分 apk 不是我想要的,因为它为每个密度文件夹构建一个 apk

【问题讨论】:

  • 一开始就不提供它们怎么办?

标签: android gradle apk


【解决方案1】:

我从未测试过,但您或许可以使用 android.splits.density 块来排除屏幕密度

https://developer.android.com/studio/build/gradle-tips#configure-separate-apks-per-screen-density

摘录:

android {
  ...
  splits {

    // Configures multiple APKs based on screen density.
    density {

      // Enables building multiple APKs.
      enable true

      // Specifies a list of screen densities Gradle should not create APKs for.
      exclude "xxxhdpi"
      ...
    }
  }
}

【讨论】:

  • 这将为每个未排除的密度生成多个 apk,不幸的是这不是我想要的
猜你喜欢
  • 1970-01-01
  • 2010-11-17
  • 1970-01-01
  • 2019-07-14
  • 2016-04-19
  • 2015-11-06
  • 2023-04-05
  • 2023-03-23
  • 2018-03-23
相关资源
最近更新 更多