QApplication crashes on constructor from JNI (Android)



  • Hi all,

    I've created a library that uses Qt Widgets; if called from non-Qt application, it creates an instance of QApplication.
    Everything works fine on Windows and linux, from C app and also from a Java app (using JNA).
    It works also in Android if called from a Qt app.
    Now I'm trying to get it to work on Android calling it from a Java application made with Android Studio, using JNI.
    At first I had a problem finding the platform plugin, but solved setting the QT_QPA_PLATFORM_PLUGIN_PATH.
    But when I create QApplication object, it crashes on constructor, with SIGSEGV in libc.
    I don't think that is a problem with argc and argv parameters, because If I create a QCoreApplication instead it doesn't crash, but I need widgets...
    I am using Qt 5.6.2, but tried also 5.8 and 5.9.1, same result.
    And NDK r10e, but also with r14b is the same.

    In the Android Studio project, in the folder jniLibs\armeabi-v7a, I've put the following libs together with mine:

    libgnustl_shared.so
    libplugins_platforms_android_libqtforandroid.so
    libQt5AndroidExtras.so
    libQt5Core.so
    libQt5Gui.so
    libQt5Multimedia.so
    libQt5Network.so
    libQt5Widgets.so

    I have copied them from the APK that the working Qt app generates...

    Have you any suggestions?
    Thanks


  • Lifetime Qt Champion

    Hi,

    Can you share the stack trace ?



  • Hi,

    sorry, I'm completely new to Android Studio...
    In the logcat I see only this line:
    08-07 08:51:41.810 17576-17576/com.example.gb.myndkapplication2 A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 17576 (ndkapplication2)

    Do you mean this?
    0_1502089078952_StackTrace.png

    Thanks


  • Lifetime Qt Champion

    Based on this thread, it seems that other people had some success using Qt classes from an Android application.

    However, I don't know whether the GUI part can be used that way. I think you should check the Qt Android mailing list to find out whether it's currently supported. You'll find there Qt's Android port developers/maintainers. This forum is more user oriented.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.