的System.loadLibrary()错误 [英] System.loadLibrary() error
问题描述
我成功的交叉编译一个C ++库的Android NDK的,独立的工具链 然后,我创建了一个新的Android应用程序项目到Eclipse,当我把mylib.so到JNI文件夹并执行NDK,构建命令正常工作
I successfully cross-compiled a c++ library with the android ndk-Standalone toolchain then, i created a new android application project into Eclipse and when i put mylib.so into the jni folder and execute ndk-build commands it works fine
Prebuilt : mylib.so <= jni/
Install : mylib.so => libs/armeabi/mylib.so
但是,当添加
But when adding
static{
System.load("/data/data/my_package/lib/mylib.so");
}
我得到了logcat的一个错误,说
i got an error in the logcat saying
AndroidRuntime
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library:
reloc_library[1306]: 36 cannot locate 'xmlCleanupParser'...``
我用Google搜索,但没有找到任何办法来解决这个问题。
i googled it but didn't find any way to solve this problem.
推荐答案
我最近遇到了同样的错误。在尝试从等几十个建议,我终于想通了,在错误是在我的家乡code。尽管Android的 NDK已经编译它没有任何问题/警告。
I recently encountered the same error. After trying out dozens of suggestions from SO, I finally figured out that the error was in my native code. even though android ndk had compiled it without any issues / warnings.
试着写一个简单的main函数来测试你的本地code和G ++ / GCC(或类似的东西)来检查错误编译。
Try writing a simple main function to test your native code and compile with g++/gcc (or something similar) to check for errors.
我知道它的太迟了提问者,而是希望别人认为这是有用的。
I know its too late for the asker, but hope someone else finds this useful.
这篇关于的System.loadLibrary()错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!