将.so添加到Xamarin android绑定库 [英] Adding .so to Xamarin android binding library
问题描述
我有一个xamarin android项目(VS2015),我添加了一个Android绑定库项目以使用Java库.包装程序工作正常,我可以在我的应用程序项目中调用类/方法.但是,其中一个Java类取决于
I have a xamarin android project (VS2015) which I added a Android bindings library project to to use a java lib. The wrapper works fine and I can call the classes/methods in my application project. However one of the java classes depends on
armeabi/libjnisgfplib.so
armeabi/libjnisgfplib.so
我尝试在应用程序中同时添加到/Assets和/libs中. BuildAction = AndroidNativeLibrary,复制=始终.但是它找不到lib,而且我一直在获取.
I have tried adding to both /Assets and /libs within my application. BuildAction = AndroidNativeLibrary, Copy = Always. Yet it can't find the lib and I keep getting.
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader [DexPathList [[zip文件 "/data/app/com.company-1/base.apk"],nativeLibraryDirectories=[/data/app/com.company-1/lib/arm, /vendor/lib,/system/lib]]]找不到"libjnisgfplib.so"
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.company-1/base.apk"],nativeLibraryDirectories=[/data/app/com.company-1/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libjnisgfplib.so"
在调用该类之前,我已经尝试过Java.Lang.JavaSystem.LoadLibrary("libjnisgfplib");
,但是我收到了同样的证据.
I have tried Java.Lang.JavaSystem.LoadLibrary("libjnisgfplib");
before calling the class but I receive the same exeption.
如何将libjnisgfplib.so添加到我的项目中,以便绑定库jar可以找到它?
How can I add libjnisgfplib.so to my project so the binding library jar can find it?
推荐答案
所以对我来说,这是行之有效的,但是为什么将名称从
So it's a total mastery to me why this worked but changing the name from
libjnisgfplib.so 到 jnisgfplib.so
libjnisgfplib.so to jnisgfplib.so
工作.我假设它被lib/libjnis抛弃了,但是lib/jnis很好.
worked. I am assuming something about it being lib/libjnis was throwing it off, but lib/jnis is fine.
这篇关于将.so添加到Xamarin android绑定库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!