Gradle 排除 arm64 库

2023-02-02移动开发问题
13

本文介绍了Gradle 排除 arm64 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我有一个包含两个库的应用程序,它们都依赖于本机库.两者都使用 gradle 包含,因此结构如下所示:

I have an application including two libraries, where both of them have dependencies on native libraries. Both are included using gradle so the structure looks like this:

我的应用

- Libary1
-- x86, armeabi native libs
- Library2
-- Library3
--- x86, armeabi, arm64-v8a

我想删除 arm64 支持,因为我还需要 *.so 用于 Library1,而我没有.(所以目前我在 arm64 设备上遇到 UnsatisfiedLinkError)

I want to remove the arm64 support as i would also need that *.so for Library1, which i don't have. (so currently i get an UnsatisfiedLinkError on arm64 devices)

我已经尝试过了:(使用 abiFilters "armeabi", "x86")https://stackoverflow.com/a/30799825/3325222

I already tried this: (with abiFilters "armeabi", "x86") https://stackoverflow.com/a/30799825/3325222

但我仍然在我的 apk 中获得 arm64 文件夹和 *.so 文件...我缺少什么吗?如果原生库在依赖层次结构中更深,那 abiFilter 的东西甚至应该可以工作,对吧?

But i still get the arm64 folder and *.so files in my apk... is there something i'm missing? That abiFilter stuff should even work if the native libs are deeper inside the dependency hierarchy right?

提前感谢您的支持:)

推荐答案

我找到了一个解决方案,方法是排除刚刚添加到我不想支持的架构中的特定 *.so 文件:

I found a solution by excluding the specific *.so files that were just added inside the architectures i didn't want to support:

packagingOptions {
  exclude 'lib/arm64-v8a/lib.so'
  exclude 'lib/mips/lib.so'
}

这篇关于Gradle 排除 arm64 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

如何在 COCOS2d Android 中使用 CClistview?
How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)...
2024-08-12 移动开发问题
5

cocos2d-android:如何显示分数
cocos2d-android: how to display score(cocos2d-android:如何显示分数)...
2024-08-11 移动开发问题
7

Sqlite 数据库未从资产文件夹 Android 复制
Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)...
2024-04-15 移动开发问题
8

SQLite 数据库副本在由设备而不是模拟器生成时出现损坏
SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)...
2024-04-15 移动开发问题
4

安卓文件拷贝
Android file copy(安卓文件拷贝)...
2024-04-15 移动开发问题
6

Android如何在android中检测Edittext的Copy事件
Android how to detect Copy event of Edittext in android(Android如何在android中检测Edittext的Copy事件)...
2024-04-15 移动开发问题
5