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. Unable to debug the Android Application Waiting for Debugger

Unable to debug the Android Application Waiting for Debugger

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
15 Posts 7 Posters 3.1k 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.
  • X xpress_embedo

    Hello Everyone,
    I am new to Qt and Android development, and as of now, I am trying to write my first Android Application using Qt.
    Let's say I started with a simple "hello world" program, which worked fine when I directly deployed it, but when I tried to debug it, on Android it gets stuck with the message "Waiting for Debugger", and on Qt Creator, it gets stuck with the message "Launching Debugger".

    I am getting this on Qt Creator
    598016f6-9ae1-4df8-ab87-ab22fb08fa59-image.png

    And the following on my Android Phone
    Screenshot_2023-07-30-13-17-12-935.jpg

    Qt Creator Version
    105a808e-ac04-4eab-80ce-e8a2c2e2d968-image.png

    Qt Version 6.5.2
    ff2db8c8-bc06-48bf-aabb-6746146f2b11-image.png

    Also sharing this screenshot.
    2c106cf0-b828-45ad-a45e-5f242eb25163-image.png
    Note: Here it is showing a JDK path error, but I think it is a false positive.
    Earlier I was using OpenJDK version 11 and some very old versions of Android SDK and also the 6.2.5 Qt version, but since things were not working fine, I thought to upgrade everything to the latest available versions.
    The first thing I did was to upgrade the SDK version, and once I upgraded the SDK version, it was not supported by OpenJDK version 11, hence I have to upgrade the JDK or downgrade the SDK version, and here I upgraded the JDK version, and Qt is complaining but everything works fine like I can open SDK manager etc.

    Can someone please suggest what should I do?
    Why deployment is working fine but not the debugging?

    Thanks, and Regards


    Update.
    I was using a Physical phone, and now I used an "Android Emulator" and the situation is more or less the same.
    450b788b-53e9-46e0-9428-67b072e658f2-image.png

    Please suggest something to fix this issue.

    Axel SpoerlA Offline
    Axel SpoerlA Offline
    Axel Spoerl
    Moderators
    wrote on last edited by
    #2

    @xpress_embedo

    If we ignore the JDK path error (which is regally weird): Is debug mode activated on the android device?

    Software Engineer
    The Qt Company, Oslo

    X 1 Reply Last reply
    0
    • Axel SpoerlA Axel Spoerl

      @xpress_embedo

      If we ignore the JDK path error (which is regally weird): Is debug mode activated on the android device?

      X Offline
      X Offline
      xpress_embedo
      wrote on last edited by
      #3

      @Axel-Spoerl I assume if JDK is actually an error than SDK manager will not open. This is what I assume.
      Anyhow with 6.2.5 this was not an issue.
      Android Developer Options are enabled and I can program the application directly from Qt but not debug.
      I have updated my message also, i created an emulator and the problem is still same, so looks like some issue with Qt creator settings.

      Axel SpoerlA 1 Reply Last reply
      0
      • X xpress_embedo

        @Axel-Spoerl I assume if JDK is actually an error than SDK manager will not open. This is what I assume.
        Anyhow with 6.2.5 this was not an issue.
        Android Developer Options are enabled and I can program the application directly from Qt but not debug.
        I have updated my message also, i created an emulator and the problem is still same, so looks like some issue with Qt creator settings.

        Axel SpoerlA Offline
        Axel SpoerlA Offline
        Axel Spoerl
        Moderators
        wrote on last edited by
        #4

        @xpress_embedo
        Thanks for the additional details.
        Looks like an SDK incompatibility to me.
        Have you checked this?

        Software Engineer
        The Qt Company, Oslo

        JoeCFDJ X 2 Replies Last reply
        1
        • Axel SpoerlA Axel Spoerl

          @xpress_embedo
          Thanks for the additional details.
          Looks like an SDK incompatibility to me.
          Have you checked this?

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #5

          @Axel-Spoerl You are right, Axel.
          from here: https://developer.android.com/build/jdks
          14 (API 34) 17 Core libraries
          13 (API 33) 11 Core libraries
          12 (API 32) 11 Java API

          The highest version of JAVA supported is 17. He is using 19. At least, that is a bug.

          @xpress_embedo: you need to know your Android version first.

          X 2 Replies Last reply
          0
          • Axel SpoerlA Axel Spoerl

            @xpress_embedo
            Thanks for the additional details.
            Looks like an SDK incompatibility to me.
            Have you checked this?

            X Offline
            X Offline
            xpress_embedo
            wrote on last edited by
            #6

            @Axel-Spoerl Thank You for your response.
            Actually, the screenshot I shared above was after the update and that's why JDK is in red colour.
            But earlier also, when everything was fine, the situation was similar.
            Anyways I will double-check again.
            But as I mentioned, deployment was fine, the problem is with debugging only.
            Plus I can use SDKManager from inside the Qt Creator.

            1 Reply Last reply
            0
            • JoeCFDJ JoeCFD

              @Axel-Spoerl You are right, Axel.
              from here: https://developer.android.com/build/jdks
              14 (API 34) 17 Core libraries
              13 (API 33) 11 Core libraries
              12 (API 32) 11 Java API

              The highest version of JAVA supported is 17. He is using 19. At least, that is a bug.

              @xpress_embedo: you need to know your Android version first.

              X Offline
              X Offline
              xpress_embedo
              wrote on last edited by
              #7

              @JoeCFD said in Unable to debug the Android Application Waiting for Debugger:

              @Axel-Spoerl You are right, Axel.
              from here: https://developer.android.com/build/jdks
              14 (API 34) 17 Core libraries
              13 (API 33) 11 Core libraries
              12 (API 32) 11 Java API

              The highest version of JAVA supported is 17. He is using 19. At least, that is a bug.

              @xpress_embedo: you need to know your Android version first.

              Thanks, @JoeCFD I will double-check, by downgrading the Java version.
              My phone is a little old API 29.

              Just an update, I installed everything on my Windows Laptop, and everything works fine here without any problem.
              As of now the only difference between Windows and Ubuntu machine is the Java version, on Windows I am using 17, while on Ubuntu it is 19

              X 1 Reply Last reply
              0
              • X xpress_embedo

                @JoeCFD said in Unable to debug the Android Application Waiting for Debugger:

                @Axel-Spoerl You are right, Axel.
                from here: https://developer.android.com/build/jdks
                14 (API 34) 17 Core libraries
                13 (API 33) 11 Core libraries
                12 (API 32) 11 Java API

                The highest version of JAVA supported is 17. He is using 19. At least, that is a bug.

                @xpress_embedo: you need to know your Android version first.

                Thanks, @JoeCFD I will double-check, by downgrading the Java version.
                My phone is a little old API 29.

                Just an update, I installed everything on my Windows Laptop, and everything works fine here without any problem.
                As of now the only difference between Windows and Ubuntu machine is the Java version, on Windows I am using 17, while on Ubuntu it is 19

                X Offline
                X Offline
                xpress_embedo
                wrote on last edited by
                #8

                As suggested by you guys.
                I downgraded the version of Java to version 17.
                Still, the problem is the same.
                ddca4f6a-a340-4f63-98a9-b67ee8ec560f-image.png

                And also in Android Kit JDK is highlighted in red.
                bf4d088b-898f-4a23-abea-a7e939858514-image.png

                Any other suggestions??

                1 Reply Last reply
                0
                • JoeCFDJ JoeCFD

                  @Axel-Spoerl You are right, Axel.
                  from here: https://developer.android.com/build/jdks
                  14 (API 34) 17 Core libraries
                  13 (API 33) 11 Core libraries
                  12 (API 32) 11 Java API

                  The highest version of JAVA supported is 17. He is using 19. At least, that is a bug.

                  @xpress_embedo: you need to know your Android version first.

                  X Offline
                  X Offline
                  xpress_embedo
                  wrote on last edited by
                  #9

                  @JoeCFD @Axel-Spoerl
                  Now everything is green.
                  a7baf437-ee28-418d-8fbf-cd448ec1aaf1-image.png

                  But the problem is still the same.
                  I can program/install the application directly from Qt Creator, but I can't debug it.
                  alt text

                  Can anyone please suggest, what can be done here?

                  Axel SpoerlA S 2 Replies Last reply
                  0
                  • X xpress_embedo

                    @JoeCFD @Axel-Spoerl
                    Now everything is green.
                    a7baf437-ee28-418d-8fbf-cd448ec1aaf1-image.png

                    But the problem is still the same.
                    I can program/install the application directly from Qt Creator, but I can't debug it.
                    alt text

                    Can anyone please suggest, what can be done here?

                    Axel SpoerlA Offline
                    Axel SpoerlA Offline
                    Axel Spoerl
                    Moderators
                    wrote on last edited by
                    #10

                    @xpress_embedo
                    Is your device in developer mode?

                    Software Engineer
                    The Qt Company, Oslo

                    X 1 Reply Last reply
                    0
                    • Axel SpoerlA Axel Spoerl

                      @xpress_embedo
                      Is your device in developer mode?

                      X Offline
                      X Offline
                      xpress_embedo
                      wrote on last edited by
                      #11

                      @Axel-Spoerl said in Unable to debug the Android Application Waiting for Debugger:

                      @xpress_embedo
                      Is your device in developer mode?

                      Yes, it is enabled.
                      I installed Qt on my Windows Laptop, and everything works fine on it, I can install and debug.
                      While with Ubuntu laptop programming/Installation works fine, but not debugging, and this problem is not only with Android Phones but also with the Emulator device.

                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        JoanBradyVip
                        wrote on last edited by
                        #12
                        This post is deleted!
                        1 Reply Last reply
                        0
                        • X xpress_embedo

                          @JoeCFD @Axel-Spoerl
                          Now everything is green.
                          a7baf437-ee28-418d-8fbf-cd448ec1aaf1-image.png

                          But the problem is still the same.
                          I can program/install the application directly from Qt Creator, but I can't debug it.
                          alt text

                          Can anyone please suggest, what can be done here?

                          S Offline
                          S Offline
                          Smacker
                          wrote on last edited by Smacker
                          #13

                          @xpress_embedo
                          Same issue here. Trying to find a solution almost 1 year.
                          Using QT 5.15.11 and temurin jdk 17.
                          Have two devices. A regular tablet and another device (not a table or phone).
                          The tablet is running Android 9. The other device is Android 11

                          On the tablet - everything is fine. Debugging is working. But on the other device, debugging stuck as yours:
                          5b6429e6-4370-4dea-b955-d81d5449c46c-image.png

                          My observation: In some reason, QT Creator is not receiving the next message:
                          W ActivityThread: Application org.XXX.YYY.ZZ is waiting for the debugger on port 8100...
                          Which actually is present in logcat (on both devices) and in the Application output pane when only debugging on the Tablet.
                          I guess some of the adb sh*ts is not sending notification to QT creator about the debugger status.

                          Any ideas what change in Android 11 is preventing QT Creator to receive such messages, notifications or whatever and not attaching the debugger ?

                          1 Reply Last reply
                          0
                          • cristian-adamC Offline
                            cristian-adamC Offline
                            cristian-adam
                            wrote on last edited by cristian-adam
                            #14

                            At https://bugreports.qt.io/browse/QTCREATORBUG-31277 I have a similar case, but with Windows as host.

                            I've added more logging for the jdb debugger settling in newer Qt Creator versions. On my machine I've got from Tools > Debug Qt Creator > Show Logs... and checking the Debug checkbox for qtc.android.run.androidrunnerworker something like:

                            18:03:12.238 qtc.android.run.androidrunnerworker: QML debugging enabled
                            18:03:12.238 qtc.android.run.androidrunnerworker: QML server: "tcp://127.0.0.1:63927"
                            18:03:12.238 qtc.android.run.androidrunnerworker: Environment variables for the app QList()
                            18:03:12.252 qtc.android.run.androidrunnerworker: Device Serial: emulator-5554 , API level: 34 , Extra Start Args: QList() , Before Start ADB cmds: QList() , After finish ADB cmds: QList() , Debug server path: /Users/cristian/Library/Android/sdk/ndk/26.2.11394342/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/17.0.2/lib/linux/aarch64/lldb-server
                            18:03:12.340 qtc.android.run.androidrunnerworker: Running logcat command (async): /Users/cristian/Library/Android/sdk/platform-tools/adb -s emulator-5554 logcat -T '07-22 18:03:09.033'
                            18:03:12.378 qtc.android.run.androidrunnerworker: Using application arguments:  QList(-qmljsdebugger=port:63927,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector,DebugTranslation)
                            18:03:12.741 qtc.android.run.androidrunnerworker: Process ID changed from: -1 to: 18195
                            18:03:12.783 qtc.android.run.androidrunnerworker: Starting JDB: /opt/homebrew/Cellar/openjdk@17/17.0.12/bin/jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=5038
                            18:03:12.855 qtc.android.run.androidrunnerworker: Uploading GdbServer
                            18:03:13.135 qtc.android.run.androidrunnerworker: Debugger process started
                            18:03:14.357 qtc.android.run.androidrunnerworker: Handle JDB settled
                            18:03:14.861 qtc.android.run.androidrunnerworker: JDB output: "Set uncaught java.lang.Throwable\nSet deferred uncaught java.lang.Throwable\nInitializing jdb ...\n> "
                            18:03:14.861 qtc.android.run.androidrunnerworker: JDB input: "ignore uncaught java.lang.Throwable"
                            18:03:15.361 qtc.android.run.androidrunnerworker: JDB output: ""
                            18:03:15.862 qtc.android.run.androidrunnerworker: JDB output: ""
                            18:03:16.086 qtc.android.run.androidrunnerworker: JDB output: "Removed: uncaught java.lang.Throwable\n> "
                            18:03:16.086 qtc.android.run.androidrunnerworker: JDB input: "threads"
                            18:03:16.090 qtc.android.run.androidrunnerworker: JDB output: "Group system:\n"
                            18:03:16.129 qtc.android.run.androidrunnerworker: JDB output: "  (java.lang.Thread)24861 Signal Catcher                     cond. waiting\n"
                            18:03:16.133 qtc.android.run.androidrunnerworker: JDB output: "  (java.lang.Thread)24862 ADB-JDWP Connection Control Thread cond. waiting\n"
                            18:03:16.137 qtc.android.run.androidrunnerworker: JDB output: "  (java.lang.Thread)24863 HeapTaskDaemon                     cond. waiting\n"
                            18:03:16.141 qtc.android.run.androidrunnerworker: JDB output: "  (java.lang.Thread)24864 Jit thread pool worker thread 0    running\n"
                            18:03:16.146 qtc.android.run.androidrunnerworker: JDB output: "  (java.lang.Thread)24865 FinalizerWatchdogDaemon            cond. waiting\n"
                            18:03:16.150 qtc.android.run.androidrunnerworker: JDB output: "  (java.lang.Thread)24866 FinalizerDaemon                    cond. waiting\n"
                            18:03:16.153 qtc.android.run.androidrunnerworker: JDB output: "  (java.lang.Thread)24867 ReferenceQueueDaemon               cond. waiting\n"
                            18:03:16.157 qtc.android.run.androidrunnerworker: JDB output: "  (java.lang.Thread)24871 Profile Saver                      running\n"
                            18:03:16.162 qtc.android.run.androidrunnerworker: JDB output: "Group main:\n"
                            18:03:16.165 qtc.android.run.androidrunnerworker: JDB output: "  (java.lang.Thread)24853 main                               sleeping\n"
                            18:03:16.169 qtc.android.run.androidrunnerworker: JDB output: "  (java.lang.Thread)24868 binder:18195_1                     running\n"
                            18:03:16.173 qtc.android.run.androidrunnerworker: JDB output: "  (java.lang.Thread)24869 binder:18195_2                     running\n"
                            18:03:16.177 qtc.android.run.androidrunnerworker: JDB output: "  (java.lang.Thread)24870 binder:18195_3                     running\n"
                            18:03:16.182 qtc.android.run.androidrunnerworker: JDB output: "  (java.lang.Thread)24860 RenderThread                       running\n"
                            18:03:16.186 qtc.android.run.androidrunnerworker: JDB output: "  (java.lang.Thread)24887 qtMainLoopThread                   cond. waiting\n> "
                            18:03:16.186 qtc.android.run.androidrunnerworker: JDB input: "cont"
                            18:03:16.186 qtc.android.run.androidrunnerworker: JDB output: "> Nothing suspended.\n"
                            18:03:16.186 qtc.android.run.androidrunnerworker: JDB input: "exit"
                            18:03:16.191 qtc.android.run.androidrunnerworker: JDB settled
                            

                            Check the logs. /opt/homebrew/Cellar/openjdk@17/17.0.12/bin/jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=5038 is the part that's important.

                            jdb needs to connect to the device on port 5038.

                            Alternatively you can start Qt Creator as QT_LOGGING_RULES=qtc.android*=true qtcreator to get all the Qt Creator android logging.

                            1 Reply Last reply
                            1
                            • U Offline
                              U Offline
                              Ugly Beard
                              wrote on last edited by Ugly Beard
                              #15

                              Qt is very sensitive to the environment, and releases often contain bugs.
                              The main conditions for successful assembly and debugging in my case:

                              • Android build-tool version: should be the latest, i.e. the maximum with which the build is successful. If the build is not successful, then the version should be downgraded.
                              • Android build platform SDK: should be the latest, i.e. the maximum, with which the build is successful. If the build is not successful, then you should downgrade the version (https://doc.qt.io/qt-6/android.html + select your Qt release on the page). By the way, on 04/02/2025, the application using API 35 is not built and you should select the previous API version (34).
                              • Android NDK must be exactly the one specified in the documentation for the Qt version used (https://doc.qt.io/qt-6/android.html + select your Qt release on the page).

                              For example, for version Qt 6.8.3 and Qt creator version 16.0.0, successful building and debugging were provided by the following set of components:
                              -build-tool version: 35.0.1
                              -build platform SDK: 34 or 33
                              -android NDK: 26.1.10909125
                              Снимок.PNG
                              Снимок1.PNG

                              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