本文介绍了如何从Android应用程序中删除额外的本地依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用了arcgis,它捆绑了大型的本地依赖项。如果这意味着减小apk的大小,我不想包含x86依赖项。我如何告诉gradle自动排除x86本地库。



我在构建期间尝试手动删除它。但它在重建后再次显示。

解决方案

使用拆分:

  android {
//其他好东西在这里

split {
abi {
启用true
reset()
include'armeabi -v7a'
universalApk false
}
}
}

这告诉Android仅构建APK的ARMv7版本。您需要调整 include 这一行来列出您想要的APK。然而,您可能会更好地服务使用拆分来构建一个单独的x86 APK文件(包含'x86','armeabi-v7a')并发布,以便更好地支持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.

解决方案

Use splits:

android {
  // other good stuff here

  splits {
    abi {
      enable true
      reset()
      include 'armeabi-v7a'
      universalApk false
    }
  }
}

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.

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应用程序中删除额外的本地依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 01:06