JNI_OnLoad返回的错误版本(-1) [英] JNI_OnLoad returned bad version (-1)
问题描述
我试图加载Qt5Core库在我的Android应用程序,我得到这样的:
I'm trying to load the Qt5Core library in my Android application and I get this:
JNI_OnLoad returned bad version (-1) in /data/data/com.xxx.yyy/lib/libQt5Core.so 0x41a8f3c0
Failed to load library : Qt5Core due to link error unknown failure
java.lang.UnsatisfiedLinkError: unknown failure
at java.lang.Runtime.loadLibrary(Runtime.java:370)
这是如何我试图加载的方式:
This is the way how I'm trying to load it:
的System.loadLibrary(S);
System.loadLibrary(s);
其中S是包含几个库名字的数组。其他库加载正确..
where "s" is an array containing several library names. The other libraries are loaded correctly..
任何想法,欢迎!
所以我得到这个第一:
D / dalvikvm(11445):试图加载LIB
/data/app-lib/com.xxx.yyy/libQt5Core.so 0x42666fd8结果
D / dalvikvm(11445):添加共享库
/data/app-lib/com.xxx.yyy/libQt5Core.so 0x42666fd8
D/dalvikvm(11445): Trying to load lib /data/app-lib/com.xxx.yyy/libQt5Core.so 0x42666fd8
D/dalvikvm(11445): Added shared lib /data/app-lib/com.xxx.yyy/libQt5Core.so 0x42666fd8
E / LibrariesLoader(11445):无法加载库:Qt5Core由于链路
错误JNI_ERR从JNI_OnLoad在返回
/data/app-lib/com.xxx.yyy/libQt5Core.so
E/LibrariesLoader(11445): Failed to load library : Qt5Core due to link error JNI_ERR returned from JNI_OnLoad in "/data/app-lib/com.xxx.yyy/libQt5Core.so"
E / LibrariesLoader(11445):java.lang.UnsatisfiedLinkError中:JNI_ERR
从JNI_OnLoad在/data/app-lib/com.xxx.yyy/libQt5Core.so
E/LibrariesLoader(11445): java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app-lib/com.xxx.yyy/libQt5Core.so"
......再有就是它没有任何错误/警告加载另一个库。该库有Qt5Core.so的依赖关系。
...then there is another library which is loaded without any error/warning. That library has Qt5Core.so as dependency.
我已经调查和我得到,因为以下code这个JNI_ERR:
I have investigated and I'm getting this JNI_ERR because of the following code:
如果(VM-> GETENV(安培;!uenv.venv,JNI_VERSION_1_6)= JNI_OK)结果
返回JNI_ERR;
if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_6) != JNI_OK)
return JNI_ERR;
这是我使用的JNI的版本是1.6 !!!!
The version of JNI that I'm using is 1.6!!!!
推荐答案
在启动时,如果未找到返回JNI_ERR QtCore的JNI_OnLoad加载名为QtNative的活动。
QtCore's JNI_OnLoad loads an activity called "QtNative" when it starts and returns JNI_ERR if it is not found.
QtNative在QtAndroid-bundled.jar中定义。您可以在QT 5.3 SDK文件夹中找到它:
QT5 / 5.3 / android_armv7 /罐/ QtAndroid-bundled.jar
QtNative is defined in "QtAndroid-bundled.jar". You can find it in your QT 5.3 SDK folder: Qt5/5.3/android_armv7/jar/QtAndroid-bundled.jar
只需添加到您的项目的库文件夹中。
Just add this to your project's "libs" folder.
这篇关于JNI_OnLoad返回的错误版本(-1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!