Cannot debug calqatr on Android
I can't seem to get Android debugging to work. Here is what I did:
- Build calqatr ( the Qt example app ) on Desktop and set breakpoints - the application hits them. Fine.
a) Build calqatr for Android. I'm using MinGW supplied with the Qt installation (4.3.0, if I'm not mistaken?), Qt 5.11.0 and qtcreator 4.6.0-rc1, build SDK 27. My device is running Android 6.0. Calqatr starts up but ignores the breakpoints which are the same as in step 1. I get the following application output: https://pastebin.com/PMyxkdvV .
b) On the phone, I set the Debug app to calqatr. I get the following application output: https://pastebin.com/2JNd89TN. It says "Application org.qtproject.example.calqlatr can be debugged on port 8100...". Apart from that, nothing changes. Breakpoints are still ignored.
c) On the phone, I activate "Wait for debugger". When I start debugging in Qt Creator, the app fails to start up and is stuck in "Waiting for Debugger". All I can do is force close. I've waited more that a minute. After some time, Qt Creator says "Failed to contact debugging port.". I obtain the following application output: https://pastebin.com/jhtundcM. Note that I can only obtain that output when running the app normally (using Ctrl+R) - with F5, I cannot obtain any output at all. Using Android studio, I can connect to the phone in that state and connect to the process. The process then crashes, unsurprisingly.
d) Add android:debuggable="true" in AndroidManifest.xml. Does not help.
e) Try android build SDK 23. Does not help.
As a last resort, I also tried "Debug > Start Debugging > Attach to running Debug server" with port 8100 and executable libcalqlatr.so. ( I don't know if that makes sense ). It says "Debugging starts" in blue but fails with
"Connecting to remote server failed:
tcp::8100: The system tried to join a drive to a directory on a joined drive."
I'm using an unmodified Galaxy S5 (no root etc., knox is active).
During all tests, the laptop and the phone were in the same Wifi network. Although I think that debugging should also work over USB cable only..
I also tried using Qt Creator 4.6.1, it says "Can't find C++ debugger." when run in Debug mode. Qt Creator 4.3.0 does not work as it tries to use Ant for deployment.
Any Android developers here that can help? What is your configuration, in case you can actually debug?
I'm using MinGW supplied with the Qt installation
I really doubt this as QtCreator uses the compiler provided by Android NDK.
@jsulm Hmm, looking at the logs you are absolutely right - so this has nothing to do with MinGW at least..
Note that I can actually debug Java stuff from Android Studio. I can also halt threads there. But that is not useful as I need the breakpoints in Qt Creator.
@Mitmischer Did you check your Android Kit - is debugger set up properly?
@jsulm The kits were auto-detected by Qt Creator - You can find the configuration below:
@Mitmischer Just to be sure: you're building in Debug mode?
just a couple of points to also check
- have you enabled usb-debugging on your Android device?
- do you use an at least 4 wire cable -> make sure you can access the filesystem of the android device from your pc
- have you confirmed the trustworthiness of your pc on the device
- have you installed the
Google USB Drivertogether with the other SDK - packages?
@jsulm Yes, I am building in debug mode. Also on the phone, USB debugging etc. is activated. I mean, I can build the Qt app on Desktop with debugging and I can build Android Java apps on the phone with debugging (using Android studio) - it's only the combination of Qt app and Android that I cannot debug.
@jsulm @J-Hilk USB-debugging is enabled and I can copy and read files from the PC to the phone. I installed a SAMSUNG USB driver, I hope that one is sufficient: I can control the phone by adb. What bothers me most is that I can attach to a running Qt app using Android Studio, so it looks to me that QtCreator is missing something or is not connecting properly. Sadly, debugging Qt Android apps with Android Studio is not useful..
Ok, I got news - maybe the connection itself is not at fault. I noted that I can pause the application from QtCreator. Pausing is successful as the app is unresponsive during the pause and it continues running afterwards. But in the pause, QtCreator gives me some disassembled code, no source code. Also, the stack trace consists of two lines of ??, that looks like missing debug information to me. What's more, if I try to jump to a line, I get the error message "[...] No symbol table loaded.". But I am definitely running a debug build as indicated in the configuration in the bottom left. The QML profiler is working absolutely fine. And still, if I activate "Wait for debugger" on the phone, I see the message "Failed to contact debugging port." on the phone. Something's fishy :|
@Mitmischer this is the exact problem we are having, all the same things we've tried as well. Did you find a solution? Thanks!
@tseg actually, seeing the date of this thread, I have a guess what may be the case here,
What version of Qtcreator are you using ? Haven‘t tried it with the newset, 4.7 one yet, but the android debugger kind of broke after 4.6, try it with a version prior\including to 4.6