如何从Android App Bundle中排除ABI?

时间:2019-01-08 16:52:10

标签: android gradle google-play android-app-bundle

我知道在Gradle中生成拆分时可以选择排除ABI,如下所示:

android {
  splits {

    // Configures multiple APKs based on ABI.
    abi {

      // Enables building multiple APKs per ABI.
      enable true

      // By default all ABIs are included, so use reset() and include to specify that we only
      // want APKs for x86 and x86_64.

      // Resets the list of ABIs that Gradle should create APKs for to none.
      reset()

      // Specifies a list of ABIs that Gradle should create APKs for.
      include "x86", "x86_64"
    }
  }
}

这是official reference to splits的配置

现在,建议您在将应用发布到Play商店时使用应用捆绑包,并且使用Gradle或Play Store发布控制台,我看不到任何将ABI从该捆绑包中排除的选项。

到目前为止,我发现的唯一线索是可以启用/禁用特定的拆分变体。例如,以下是根据documentation完全禁用ABI捆绑包拆分的方法:

android {
    // When building Android App Bundles, the splits block is ignored.
    splits {...}

    // Instead, use the bundle block to control which types of configuration APKs
    // you want your app bundle to support.
    bundle {
        abi {
            // This property is set to true by default.
            enableSplit = true
        }
    }
}

但是没有提及如何禁用/启用特定的ABI集。

我已经指定了abiFilters来排除不受支持的NDK,但是看来它对App Bundle没有影响。

更新:我假设abiFilters指定要从应用捆绑销售商品中排除的ABI,但这恰好相反,其目的是列出要包括的ABI。经过澄清,一切似乎都可以正常工作。

1 个答案:

答案 0 :(得分:3)

abiFilters是必经之路。指定要包括的ABI列表,其他的将被排除。

对于Android App Bundle,您不需要“ splits”块:它将被忽略。

如果这不适用于您,那么可以请您为Gradle配置提供abiFilters设置,并说出如何确定App Bundle中存在的ABI?

相关问题