Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Dependency issue using standard library (.so file) that depends on QT packages in native Android application.



  • I am using Android Studio to develop a native Android application. I am interested in utilizing a set of APIs provided by a third party (these APIs are provided as a '.so' and affiliated 'h' file). However, these APIs have been developed on QT Creator and have various QT dependencies. As these APIs are in C++, I am using a NDK to manage this third party library.

    As I am new to using NDK, I am extending this Github project, which demonstrates how to manage 3P party C/C++ libraries in Android Studio, to incorporate the additional 3P APIs contained in a .so file provided to me.

    I used the 3P provided .so file in the same way as gperf is used in the above Github project. However, I ran into the following error:

    03-18 13:08:59.210 12948 12948 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: library "libQt5OpenGL.so" not found: needed by /data/app/~~pW_8vzM6r5D_AQNwXKMKkw==/com.example.hellolibs-K3tiF92oRwA3H4cb2FAb-A==/lib/arm64/liblisten.so in namespace classloader-namespace

    After adding libQt5OpenGL.so to the newapi/lib/arm64-v8a, newapi/lib/armeabi-v7a, newapi/lib/x86, and newapi/lib/x86_64 folders, I was missing libQt5Multimedia.so. I continued add libQt5*.so files to these folders until my app was able to run.

    Now, when my app runs, it immediately crashes and I see this error:

    04-02 23:05:01.528 3805 3805 F ample.hellolib: java_vm_ext.cc:577] JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.ClassNotFoundException: Didn't find class "org.qtproject.qt5.android.extras.QtNative" on path: DexPathList[[zip file "/data/app/~~zwBplIzpPfk_OXPn9sHXFQ==/com.example.hellolibs-rMNBz4SC14NhfaNS97A7bg==/base.apk"],nativeLibraryDirectories=[/data/app/~~zwBplIzpPfk_OXPn9sHXFQ==/com.example.hellolibs-rMNBz4SC14NhfaNS97A7bg==/lib/arm64, /data/app/~~zwBplIzpPfk_OXPn9sHXFQ==/com.example.hellolibs-rMNBz4SC14NhfaNS97A7bg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/system_ext/lib64, /system/product/lib64]]

    Not sure what next steps I can take to successfully import this .so file. Any guidance would be very much appreciated. And/or any examples of third party libraries that use QT that have been successfully used in a Native Android app through Android Studio would be great to go off of. :)



  • I feel like this is a Bug and i have the same Problem. Maybe you can Vote for this Bug: https://bugreports.qt.io/browse/QTBUG-84371
    It has the same missing QtNative Library error.


Log in to reply