Gradle 本机库在设备上未找到但存在于 apk 中 [英] Gradle native libraries not found on device but present in apk
问题描述
我的应用程序使用 Here SDK 和 Twilio SDK.两者都使用本地库(这里的 SDK 本地库从/libs 和/jniLibs 文件夹插入,Twilio SDK 从 jCenter 插入).但是在 Android 5.1 上,这里的 SDK 会抛出异常MISSING LIBRARIES: libMAPSJNI.so",尽管这个库存在于结果 APK 中.我打开了我的程序安装在设备上的文件夹,并在两种情况下比较了内容:有或没有 Twilio SDK.不同之处在于,当连接的 Twilio API 文件夹/lib 是一个文件,并且由于显而易见的原因,加载程序无法在其中看到需要在此处初始化 SDK 的本机库.如果删除 Twilio gradle 依赖项,则程序集会正常进行.可能是什么原因以及如何解决?如果需要,我可以使用这些库附加测试项目
My application uses Here SDK and Twilio SDK. Both uses native libraries (Here SDK with native libraries locally plugged in from /libs and /jniLibs folders, Twilio SDK plugged in from jCenter). But on Android 5.1 Here SDK throws exception "MISSING LIBRARIES: libMAPSJNI.so" although this library present in result APK. I opened folder where my program is installed on device and compared content in two cases: with or without Twilio SDK. The difference is that when connected Twilio API folder /lib is a file, and for obvious reasons, the loader can not see inside it native libraries needed initialize Here SDK. If remove the Twilio gradle dependency the assembly occurs normally. What could be a reason and how to fix it? If needed I can attach test project with these libs
推荐答案
你需要像这样修改你的build.gradle:
You need to modify your build.gradle like this:
android {
(...)
splits {
abi {
enable true
reset()
include 'armeabi-v7a'
universalApk false
}
}
(...)
}
可能是因为 Twilio SDK 支持 x86 而 HERE SDK 目前不支持.
It's probably because Twilio SDK supports x86 and HERE SDK currently doesn't support it.
这篇关于Gradle 本机库在设备上未找到但存在于 apk 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!