Can not debug on Android (Hangs at Waiting for Debugger... indefinitely)
-
Hey guys!
I attempted to debug a Qt android application on 3 different machines (although all openSUSE Tumbleweed). I installed Qt6.5.1 including QtCreator-10 and QtCreator-11beta via the online installer on all of the machines and followed the Getting Started Qt6.5 instructions for Android and set up everything accordingly. To eliminate as many other problem sources as possible, I simply chose one of the example apps (samegame3). I also testet this with 2 different smartphones.When I press the start debug button in QtCreator, the app is successfully deployed to the phone and starts, but then hangs at the "Waiting for Debugger..." popup. From the logs I read and after poking into QtCreator source-code a bit, it seems that the C++ debugger attaches successfully, but QtCreator somehow (silently) fails to connect the java debugger such that the app is "unlocked" from the "Waiting for debugger..." popup.
I ran one debug session (well, as far as I come) and extracted all the logs I could think of:
Application Output: https://pastebin.com/bycXR66Z
Compile Output: https://pastebin.com/ExGzYtyY
QtCreator Debug Log: https://pastebin.com/1gGWtCAs
Debugger Log: https://pastebin.com/DKiZYD82Is there anything I'm missing?
-
-
@seijikun said in Can not debug on Android (Hangs at Waiting for Debugger... indefinitely):
@JoeCFD Thanks for the response! USB Debugging on both smartphones is activated, unfortunately. (It probably wouldn't show the "Waiting for Debugger..." popup otherwise).
Debugging a normal Java-App with Android Studio works fine.@seijikun are you able to find some solution to this problem?
I am also facing the same problem, in release mode application works fine, but logic is not working and wanted to debug but some how got stucked due this problem.
Please let me know if you have some solution. -
@seijikun you are correct in the analysis. The
jdb
debugger is not settling.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. On my machine I've got fromqtc.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
Please try it out with Qt Creator 13 or newer.