NB I am not a QtCreator user. I build android apps in build scripts with qmake, make and androiddeployqt, and deploy them to the device with adb install.
I'd like to be able to see the output of qDebug, qInfo etc, and also any qml conole.log output and any other chatter from the QML engine, in abd logcat output. But in a vanilla build of a Qt app for Android, any such messages just seem to be blackholed (or at least I have no idea where they're going).
I have had some success by the combination of:
Redirecting logging to stderr using qInstallMessageHandler (as shown here).
Redirecting stderr to Android logging using the code here. (Update: subsequently discovered this approach is rather unsatisfactory as it relies on another thread listening on a pipe, and crashing apps can lose the logging immediately preceeding the crash).
But this all seems a bit clunky and and overcomplicated. Surely there's a better and simpler way? (For example, with Qt on Windows you can simply build with CONFIG += console
to get a console window with logging displayed, but that option is Windows specific).
Qt versions from 5.7 onwards of interest.
Googling this output redirection issue turns up quite a lot of mention of adb shell setprop log.redirect-stdio true
, however so far as I can tell it has no effect on Qt apps' stout/stderr.