如何从 Android 应用程序中删除额外的本机依赖项 [英] How to remove extra native dependencies from Android app

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

问题描述

我在我的应用程序中使用 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.

推荐答案

如何告诉 gradle 自动排除 x86 原生库

how do I tell gradle to automatically exclude the x86 native library

使用拆分:

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆