macdeployqt打破app

时间:2018-04-26 13:29:38

标签: qt qml qt-creator macdeployqt

我已经安装了Qt创建者5.11.0,

然后我更改了一些我需要更改旧项目的内容,当我尝试构建它时,它按预期工作,但使用macdeployqt后,我的应用无法加载。

所以,当我像这样运行macdeployqt时:

./macdeployqt /Users/`MY_USERNAME`/Downloads/build-`MY_PROJECT_NAME`-Desktop_Qt_5_11_0_clang_64bit-Release/`MY_PROJECT_NAME`.app -qmldir=/Users/`MY_USERNAME`/Downloads/build-`MY_PROJECT_NAME`-Desktop_Qt_5_11_0_clang_64bit-Release/ -dmg -verbose=3

这一切都已成功完成,但我的应用程序无法加载。 如果我尝试从QtCreator运行它,它会输出

qrc:/main.qml:1 module "QtQuick" is not installed

qrc:/main.qml:4 module "QtGraphicalEffects" is not installed

qrc:/main.qml:2 module "QtQuick.Window" is not installed

qrc:/main.qml:3 module "QtQuick.Controls" is not installed

qrc:/main.qml:1 module "QtQuick" is not installed

qrc:/main.qml:4 module "QtGraphicalEffects" is not installed

qrc:/main.qml:2 module "QtQuick.Window" is not installed

qrc:/main.qml:3 module "QtQuick.Controls" is not installed

qrc:/main.qml:1 module "QtQuick" is not installed

qrc:/main.qml:4 module "QtGraphicalEffects" is not installed

qrc:/main.qml:2 module "QtQuick.Window" is not installed

qrc:/main.qml:3 module "QtQuick.Controls" is not installed

qrc:/main.qml:1 module "QtQuick" is not installed

qrc:/main.qml:4 module "QtGraphicalEffects" is not installed

qrc:/main.qml:2 module "QtQuick.Window" is not installed

qrc:/main.qml:3 module "QtQuick.Controls" is not installed

任何帮助?

谢谢!

1 个答案:

答案 0 :(得分:1)

-qmldir选项是应用的源目录中QML文件的路径。尝试像这样运行它(假设-qmldir的参数是应用程序源目录的路径):

./macdeployqt \
    /Users/`MY_USERNAME`/Downloads/build-`MY_PROJECT_NAME`-Desktop_Qt_5_11_0_clang_64bit-Release/`MY_PROJECT_NAME`.app \
    -qmldir=/Users/`MY_USERNAME`/Downloads/`MY_PROJECT_NAME`/ \
    -dmg -verbose=3

否则,该工具将在构建目录中搜索QML文件,在该目录中它将找不到,因此不包含任何QML模块。