我正在尝试使用 qt5.4 将我的应用程序移植到 android,但出现此错误:
W/Qt (30916): qrc:/qml/FrontEnd.qml:1 ((null)): qrc:/qml/FrontEnd.qml:1:1: 模块“QtQuick”未安装
这是我的 .pro
TEMPLATE = app
TARGET = sandbox-build-android
QT+= qml quick widgets printsupport xml svg
INCLUDEPATH += [...]# my include path
# Input
HEADERS += [...] # my include
SOURCES += [...] # my source
RESOURCES += ../sandbox/resources.qrc
LIBS += -L$$PWD/../../edalab/else-datamodel-classes/build-buildAndroid-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_0-Debug/ -lbuildAndroid
INCLUDEPATH += [...]
DEPENDPATH += [...]
contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
ANDROID_EXTRA_LIBS = [..]
}
# Default rules for deployment.
include(deployment.pri)
这是我的部署.pri:
android-no-sdk {
target.path = /data/user/qt
export(target.path)
INSTALLS += target
} else:android {
x86 {
target.path = /libs/x86
} else: armeabi-v7a {
target.path = /libs/armeabi-v7a
} else {
target.path = /libs/armeabi
}
export(target.path)
INSTALLS += target
} else:unix {
isEmpty(target.path) {
qnx {
target.path = /tmp/$${TARGET}/bin
} else {
target.path = /opt/$${TARGET}/bin
}
export(target.path)
}
INSTALLS += target
}
export(INSTALLS)
在我的 FrontEnd.qml 我有这个导入:
import QtQuick 2.4
import QtQuick.Controls 1.3
我看不出与在 Android 上正常工作的示例项目的 .pro 有任何实质性区别。
更新
我看到另一个示例“日历”,我注意到我缺少这个标志“OTHER_FILES”所以我添加了我的 QML 文件的所有路径,但问题仍然存在。
我还从智能手机中检索了 apk,并提取了内容。我注意到我的 apk 没有包含一些在 apk 示例中有效的库:
libqml_Qt_labs_folderlistmodel_libqmlfolderlistmodelplugin.so libqml_Qt_labs_settings_libqmlsettingsplugin.so libqml_QtQml_Models.2_libmodelsplugin.so libqml_QtQml_StateMachine_libqtqmlstatemachine.so libqml_QtQuick.2_libqtquick2plugin.so libqml_QtQuick_Controls_libqtquickcontrolsplugin.so libqml_QtQuick_Controls_Styles_Android_libqtquickcontrolsandroidstyleplugin.so libqml_QtQuick_Dialogs_libdialogplugin.so libqml_QtQuick_Dialogs_Private_libdialogsprivateplugin.so libqml_QtQuick_Layouts_libqquicklayoutsplugin.so libqml_QtQuick_Window.2_libwindowplugin.so
我的项目目录结构
.
├── Project1
│ ├── file.pro
│ ├── images
│ │ ├── ...
│ ├── include
│ │ ├── sub1
│ │ │ ├── file1.hh
│ │ │ └── sub1.1
│ │ │ └── file2.hh
│ │ └── sub2
│ │ └── file3.hh
│ ├── qml
│ │ ├── file1.qml
│ │ └── sub1
│ │ ├── file2.qml
│ │ └── sub1.1
│ │ └── file3.qml
│ ├── README.txt
│ ├── resources.qrc
│ ├── src
│ │ ├── sub1
│ │ │ ├── file1.cc
│ │ │ └── sub1.1
│ │ │ └── file2.cc
│ │ ├── sub2
│ │ │ └── file3.cc
│ │ └── Main.cc
│ └── webUtils
│ └── file.html