gpt4 book ai didi

android - 如何在android中基于CPU架构有条件地加载 native 库

转载 作者:行者123 更新时间:2023-11-29 19:12:01 25 4
gpt4 key购买 nike

在我的应用程序中,我使用了一组本地库。这些库可用于不同的 CPU 架构。但问题是所有这些库几乎占了 apk 大小的 87%。

enter image description here

enter image description here

我想减少下载的 apk 大小,因此我想制作基于 CPU 架构的条件 apk。我该怎么做?

最佳答案

使用AbiSplitOptions .

例子:

android {
...
splits {

// Configures multiple APKs based on ABI.
abi {

// Enables building multiple APKs.
enable true

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

// Specifies a list of ABIs that Gradle should create APKs for.
include "x86", "armeabi-v7a", "mips"

// Specify that we want to also generate a universal APK that includes all ABIs.
universalApk true
}
}
}

关于android - 如何在android中基于CPU架构有条件地加载 native 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44994476/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com