我目前正在尝试开始编写基于qt的应用程序并在android上运行。唯一的问题是我无法从应用程序输出部分中的手机接收任何调试信息。
准确地说,在我遇到这个问题之后,我尝试了最简单的qml应用程序,只有 Component.onCompleted:console.log(“已启动应用程序”),后来尝试了:
并且所有这些都能正常输出正确的输出,但仍然没有使用交叉编译/本机android调试。
值得注意的是,手机也输出了一堆警告,但据我所知,这与我的问题没有任何关系。
这是exacte输出:
W System : ClassLoader referenced unknown path:
I QtCore : Start
W linker : /data/app/org.qtproject.example.testandroid-1/lib/arm/libQt5Network.so: unused DT entry: type 0x1d arg 0x13f76
W linker : /data/app/org.qtproject.example.testandroid-1/lib/arm/libQt5Network.so: unsupported flags DT_FLAGS_1=0x81
W linker : /data/app/org.qtproject.example.testandroid-1/lib/arm/libQt5Qml.so: unused DT entry: type 0x1d arg 0x39763
W linker : /data/app/org.qtproject.example.testandroid-1/lib/arm/libQt5Qml.so: unsupported flags DT_FLAGS_1=0x81
W linker : /data/app/org.qtproject.example.testandroid-1/lib/arm/libQt5Gui.so: unused DT entry: type 0x1d arg 0x55743
W linker : /data/app/org.qtproject.example.testandroid-1/lib/arm/libQt5Gui.so: unsupported flags DT_FLAGS_1=0x81
W linker : /data/app/org.qtproject.example.testandroid-1/lib/arm/libQt5Quick.so: unused DT entry: type 0x1d arg 0x4a817
W linker : /data/app/org.qtproject.example.testandroid-1/lib/arm/libQt5Quick.so: unsupported flags DT_FLAGS_1=0x81
W linker : /data/app/org.qtproject.example.testandroid-1/lib/arm/libQt5QuickParticles.so: unused DT entry: type 0x1d arg 0x55d7
W linker : /data/app/org.qtproject.example.testandroid-1/lib/arm/libQt5QuickParticles.so: unsupported flags DT_FLAGS_1=0x81
W linker : /data/app/org.qtproject.example.testandroid-1/lib/arm/libQt5QuickTemplates2.so: unused DT entry: type 0x1d arg 0x2324c
W linker : /data/app/org.qtproject.example.testandroid-1/lib/arm/libQt5QuickTemplates2.so: unsupported flags DT_FLAGS_1=0x81
W linker : /data/app/org.qtproject.example.testandroid-1/lib/arm/libQt5QuickControls2.so: unused DT entry: type 0x1d arg 0x7e21
W linker : /data/app/org.qtproject.example.testandroid-1/lib/arm/libQt5QuickControls2.so: unsupported flags DT_FLAGS_1=0x81
W linker : /data/data/org.qtproject.example.testandroid/qt-reserved-files/plugins/platforms/android/libqtforandroid.so: unused DT entry: type 0x1d arg 0x8bec
W linker : /data/data/org.qtproject.example.testandroid/qt-reserved-files/plugins/platforms/android/libqtforandroid.so: unsupported flags DT_FLAGS_1=0x81
I Qt : qt start
W linker : /data/data/org.qtproject.example.testandroid/qt-reserved-files/plugins/bearer/libqandroidbearer.so: unused DT entry: type 0x1d arg 0x1711
W linker : /data/data/org.qtproject.example.testandroid/qt-reserved-files/plugins/bearer/libqandroidbearer.so: unsupported flags DT_FLAGS_1=0x81
W linker : /data/app/org.qtproject.example.testandroid-1/lib/arm/libtestandroid.so: unused DT entry: type 0x1d arg 0x7cf
I Adreno : QUALCOMM build : 5457c29, I79fc85766c
I Adreno : Build Date : 03/07/16
I Adreno : OpenGL ES Shader Compiler Version: XE031.06.00.02
I Adreno : Local Branch : mybranch18600697
I Adreno : Remote Branch : quic/LA.BR.1.3.3_rb2.12
I Adreno : Remote Branch : NONE
I Adreno : Reconstruct Branch : NOTHING
I OpenGLRenderer: Initialized EGL, version 1.4
W Qt A11Y : Could not activate platform accessibility.
W linker : /data/data/org.qtproject.example.testandroid/qt-reserved-files/qml/QtQuick.2/libqtquick2plugin.so: unused DT entry: type 0x1d arg 0x4de
W linker : /data/data/org.qtproject.example.testandroid/qt-reserved-files/qml/QtQuick.2/libqtquick2plugin.so: unsupported flags DT_FLAGS_1=0x81
W linker : /data/data/org.qtproject.example.testandroid/qt-reserved-files/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.so: unused DT entry: type 0x1d arg 0x36b7
W linker : /data/data/org.qtproject.example.testandroid/qt-reserved-files/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.so: unsupported flags DT_FLAGS_1=0x81
W linker : /data/data/org.qtproject.example.testandroid/qt-reserved-files/qml/QtQuick/Window.2/libwindowplugin.so: unused DT entry: type 0x1d arg 0x4b2
W linker : /data/data/org.qtproject.example.testandroid/qt-reserved-files/qml/QtQuick/Window.2/libwindowplugin.so: unsupported flags DT_FLAGS_1=0x81
W linker : /data/data/org.qtproject.example.testandroid/qt-reserved-files/qml/QtQuick/Templates.2/libqtquicktemplates2plugin.so: unused DT entry: type 0x1d arg 0xc39c
W linker : /data/data/org.qtproject.example.testandroid/qt-reserved-files/qml/QtQuick/Templates.2/libqtquicktemplates2plugin.so: unsupported flags DT_FLAGS_1=0x81
W linker : /data/data/org.qtproject.example.testandroid/qt-reserved-files/qml/QtQuick/Controls.2/Material/libqtquickcontrols2materialstyleplugin.so: unused DT entry: type 0x1d arg 0x2508
W linker : /data/data/org.qtproject.example.testandroid/qt-reserved-files/qml/QtQuick/Controls.2/Material/libqtquickcontrols2materialstyleplugin.so: unsupported flags DT_FLAGS_1=0x81
I ActivityThreadEui: handleSleeping sleeping=true screenOn=false
这是我的.pro文件:
QT += quick
CONFIG += c++11
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += main.cpp
RESOURCES += qml.qrc
CONFIG += console
CONFIG+=qml_debug
CONFIG+=debug
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
注意:这是来自预装了qt的“简单”应用程序,它确实运行良好并显示,但控制台没有任何内容。
我的电脑配置:macOS 10.12.6,Imac 27 2013,qt 5.10.0,SDK版本:26.1.1,NDK版本:16.1.4479499,jdk1.8.0_40,android API 23.
我的手机配置:Leeco 2,高通652,android marshmallow 6.0.1,调试激活。
更新
然后我尝试从 console.log 更改为 console.warn 或 console.info (这似乎在输出I中有效)以前尝试过)和...魔术......它奏效了。这可能是因为它在android(link)中具有更高的优先级,但它仍然没有按预期工作,因此不显示D作为前缀而是W(console.warn)或I (console.info)。
感谢您提出所有想法。