Unable to debug the Android Application Waiting for Debugger
-
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
And the following on my Android Phone
Qt Creator Version
Qt Version 6.5.2
Also sharing this screenshot.
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.
Please suggest something to fix this issue.
-
If we ignore the JDK path error (which is regally weird): Is debug mode activated on the android device?
-
@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. -
@xpress_embedo
Thanks for the additional details.
Looks like an SDK incompatibility to me.
Have you checked this? -
@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 APIThe 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.
-
@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. -
@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 APIThe 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 -
As suggested by you guys.
I downgraded the version of Java to version 17.
Still, the problem is the same.
And also in Android Kit JDK is highlighted in red.
Any other suggestions??
-
@JoeCFD @Axel-Spoerl
Now everything is green.
But the problem is still the same.
I can program/install the application directly from Qt Creator, but I can't debug it.
Can anyone please suggest, what can be done here?
-
@xpress_embedo
Is your device in developer mode? -
@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. -
This post is deleted!
-
@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 11On the tablet - everything is fine. Debugging is working. But on the other device, debugging stuck as yours:
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 ?
-
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 forqtc.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.