java.lang.UnsatisfiedLinkError中:dalvik.system.PathClassLoader [英] java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader
问题描述
有没有人谁了经验,这个错误?
Is there someone who had experience with this error?
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.swig.simple-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "liborg.swig.simple.example.so"
当我通过这种方式装载库发生错误。
Error occurs when I load library by this way.
static {
System.loadLibrary("example");
}
我敢肯定,例如'类是存在于当前文件夹。
I'm sure 'example' class is exist in the current folder.
推荐答案
请注意,有一个命名约定。您的lib需要被libexample.so称为
Please note that there's a naming convention. Your lib needs to be called libexample.so .
调用LoadLibrary(例如)将寻找libexample.so。
LoadLibrary("example") will look for libexample.so.
的.so库必须是下的lib文件夹中的APK里面(因为你正在开发的机器人,它需要下的lib / armeabi和lib / armeabi-V7A文件夹 - 为什么这两个文件夹的一些Android版本?先看下的lib / armeabi下的lib / armeabi-V7A一些看看...本身你的作品)。
The .so library needs to be inside the apk under the lib folder (since you are developing for Android, it needs to be under the lib/armeabi and lib/armeabi-v7a folders - why both folders ? some versions of Android look under lib/armeabi and some look under lib/armeabi-v7a ... se what works for you ).
其他的事情来寻找:
-
请确保您编译为正确的体系结构(如果你编译armeabi V5它不会在armeabiv7或armeabiv7s工作)。
make sure you compile for the correct architecture (if you compile for armeabi v5 it won't work on armeabiv7 or armeabiv7s ).
请确保您的导出原型在正确的类中使用(查看Hello JNI的例子。你接触功能需要看起来像Java_mypackagename_myjavabridgeclass_myfunction)。
make sure your exported prototypes are used in the correct class (check the hello jni example. Your exposed functions need to look something like Java_mypackagename_myjavabridgeclass_myfunction).
例如函数Java_com_example_sample_hello将在Java类com.example.sample翻译,功能打招呼。
For example the function Java_com_example_sample_hello will translate in the java class com.example.sample , function hello.
这篇关于java.lang.UnsatisfiedLinkError中:dalvik.system.PathClassLoader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!