Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. A/: (null):0 ((null)): QWidget: Must construct a QApplication before a QWidget
Forum Updated to NodeBB v4.3 + New Features

A/: (null):0 ((null)): QWidget: Must construct a QApplication before a QWidget

Scheduled Pinned Locked Moved Solved Mobile and Embedded
6 Posts 2 Posters 465 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tommy704704
    wrote on last edited by
    #1

    Hello Everyone Thank for your attention and help!
    my requirement is want to Invoke *.so (Dynamic libraries encapsulated via Qt5.9.4 and has containing UI display code,, eg: QWidget) through JNI in Android Studio Chipmunk。
    But there show a mistake in the simulator(android x86):

    2022-05-12 16:09:39.101 13575-13575/com.example.ndkbuilddemo1 A/: (null):0 ((null)): QWidget: Must construct a QApplication before a QWidget

    --------- beginning of crash
    

    2022-05-12 16:09:39.101 13575-13575/com.example.ndkbuilddemo1 A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 13575 (e.ndkbuilddemo1), pid 13575 (e.ndkbuilddemo1)

    JonBJ 1 Reply Last reply
    0
    • T tommy704704

      Hello Everyone Thank for your attention and help!
      my requirement is want to Invoke *.so (Dynamic libraries encapsulated via Qt5.9.4 and has containing UI display code,, eg: QWidget) through JNI in Android Studio Chipmunk。
      But there show a mistake in the simulator(android x86):

      2022-05-12 16:09:39.101 13575-13575/com.example.ndkbuilddemo1 A/: (null):0 ((null)): QWidget: Must construct a QApplication before a QWidget

      --------- beginning of crash
      

      2022-05-12 16:09:39.101 13575-13575/com.example.ndkbuilddemo1 A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 13575 (e.ndkbuilddemo1), pid 13575 (e.ndkbuilddemo1)

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @tommy704704 said in A/: (null):0 ((null)): QWidget: Must construct a QApplication before a QWidget:

      2022-05-12 16:09:39.101 13575-13575/com.example.ndkbuilddemo1 A/: (null):0 ((null)): QWidget: Must construct a QApplication before a QWidget

      I know nothing about Android/JNI, but as the message states you must never try to create any QWidget before you have made the call to create a QApplication. Do you try to do so, or does your loaded *.so file have or create a QWidget anywhere before QApplication has been created?

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tommy704704
        wrote on last edited by
        #3

        I use the *.so encapsulated by the Qt, which has no qapplication and main function‘s entries

        JonBJ 1 Reply Last reply
        0
        • T tommy704704

          I use the *.so encapsulated by the Qt, which has no qapplication and main function‘s entries

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @tommy704704
          As I said, although I know nothing about Android/JNI the error message tells you that in Qt no QWidget can be created until after a QApplication has been constructed. What you do/have to do about that is up to you/unknown to me.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tommy704704
            wrote on last edited by tommy704704
            #5

            Because I want to reuse a ui code I wrote with qt in Android, I encapsulate the ui code into a so library. Then call and display in android studio.

            If My * .so does not use UI code(eg:QWidget), then JNI calls *.so and it works fine.

            I'm not sure if JNI can call the UI code of the so library encapsulated by Qt?

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tommy704704
              wrote on last edited by tommy704704
              #6

              *The above problem has been solved but the app will still crash, this is the output information. So I'm not sure if android can call .so library which contains qt ui code(eg:QWidget)

              2022-05-12 17:19:31.694 14385-14385/? I/e.ndkbuilddemo: Late-enabling -Xcheck:jni
              2022-05-12 17:19:31.707 14385-14385/? E/e.ndkbuilddemo: Unknown bits set in runtime_flags: 0x8000
              2022-05-12 17:19:31.708 14385-14385/? W/e.ndkbuilddemo: Unexpected CPU variant for X86 using defaults: x86
              2022-05-12 17:19:32.064 14385-14420/com.example.ndkbuilddemo1 D/libEGL: Emulator has host GPU support, qemu.gles is set to 1.
              2022-05-12 17:19:32.065 14385-14420/com.example.ndkbuilddemo1 W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied)
              2022-05-12 17:19:32.071 14385-14420/com.example.ndkbuilddemo1 D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
              2022-05-12 17:19:32.072 14385-14420/com.example.ndkbuilddemo1 D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
              2022-05-12 17:19:32.074 14385-14420/com.example.ndkbuilddemo1 D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
              2022-05-12 17:19:32.053 14385-14385/com.example.ndkbuilddemo1 W/RenderThread: type=1400 audit(0.0:57): avc: denied { write } for name="property_service" dev="tmpfs" ino=8412 scontext=u:r:untrusted_app:s0:c155,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0 app=com.example.ndkbuilddemo1
              2022-05-12 17:19:32.107 14385-14385/com.example.ndkbuilddemo1 E/linker: normalize_path - invalid input: "C", the input path should be absolute
              2022-05-12 17:19:32.107 14385-14385/com.example.ndkbuilddemo1 W/linker: Warning: unable to normalize "C" (ignoring)
              2022-05-12 17:19:32.107 14385-14385/com.example.ndkbuilddemo1 E/linker: normalize_path - invalid input: "C", the input path should be absolute
              2022-05-12 17:19:32.107 14385-14385/com.example.ndkbuilddemo1 W/linker: Warning: unable to normalize "C" (ignoring)
              2022-05-12 17:19:32.107 14385-14385/com.example.ndkbuilddemo1 W/linker: Warning: "/data/app/com.example.ndkbuilddemo1--lwfCEoLIsl6NMByZznOPw==/lib/x86/libQt5Widgets.so" has unsupported flags DT_FLAGS_1=0x81 (ignoring unsupported flags)
              2022-05-12 17:19:32.107 14385-14385/com.example.ndkbuilddemo1 W/linker: Warning: "/data/app/com.example.ndkbuilddemo1--lwfCEoLIsl6NMByZznOPw==/lib/x86/libQt5Gui.so" has unsupported flags DT_FLAGS_1=0x81 (ignoring unsupported flags)

              --------- beginning of crash
              

              2022-05-12 17:19:32.121 14385-14385/com.example.ndkbuilddemo1 A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 14385 (e.ndkbuilddemo1), pid 14385 (e.ndkbuilddemo1)
              2022-05-12 17:19:32.107 14385-14385/com.example.ndkbuilddemo1 W/linker: Warning: "/data/app/com.example.ndkbuilddemo1--lwfCEoLIsl6NMByZznOPw==/lib/x86/libQt5Gui.so" has unsupported flags DT_FLAGS_1=0x81 (ignoring unsupported flags)

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved