问题描述
我在我的应用程序中使用arcgis,它捆绑了很大的本机依赖项.我不想包括x86依赖项,如果这意味着减小apk的大小.我如何告诉gradle自动排除x86本机库.
I am using arcgis in my app and it bundles native dependencies that are large in size. I don't want to include the x86 dependency if it means reducing the size of the apk. how do I tell gradle to automatically exclude the x86 native library.
我尝试在构建过程中手动将其删除.但重建后会再次显示.
I tried removing it manually during the build. but it shows up again after rebuild.
推荐答案
使用拆分:
android {
// other good stuff here
splits {
abi {
enable true
reset()
include 'armeabi-v7a'
universalApk false
}
}
}
这告诉Android仅构建您的APK的ARMv7版本.您需要调整include
行以列出所需的APK.
This tells Android to build only an ARMv7 version of your APK. You would need to adjust the include
line to list what APKs you want.
但是,最好使用拆分来构建一个单独的x86 APK文件(具有include 'x86', 'armeabi-v7a'
)并同时发布它们,以便更好地支持x86,但文件更小.
However, you may be better served using splits to just build a separate x86 APK file (have include 'x86', 'armeabi-v7a'
) and ship both, so you better support x86 but still have smaller files.
这篇关于如何从Android应用中删除额外的本机依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!