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);
where "s" is an array containing several library names. The other libraries are loaded correctly..
Any ideas are welcome!
SO I'm getting this first:
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 0x42666fd8E/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 returned from JNI_OnLoad in "/data/app-lib/com.xxx.yyy/libQt5Core.so"
...then there is another library which is loaded without any error/warning. That library has Qt5Core.so as dependency.
I have investigated and I'm getting this JNI_ERR because of the following code:
if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_6) != JNI_OK)
return JNI_ERR;
The version of JNI that I'm using is 1.6!!!!
QtCore's JNI_OnLoad loads an activity called "QtNative" when it starts and returns JNI_ERR if it is not found.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With