简体   繁体   English

QML android 应用程序使用 QtQuick.Shapes,找不到模块

[英]QML android application using QtQuick.Shapes, module not found

I have a Qt 5.12.9 qml android application.我有一个 Qt 5.12.9 qml android 应用程序。 It works well but I have to "import QtQuick.Shapes 1.12" in a file and with it, at execution I get:它运行良好,但我必须在文件中“导入 QtQuick.Shapes 1.12”,并在执行时得到:

module "QtQuick.Shapes" plugin "qmlshapesplugin" not found

I import well Quick module as there is no complain about it and my application works well without the Shapes import.我很好地导入了 Quick 模块,因为没有任何抱怨,而且我的应用程序在没有 Shapes 导入的情况下运行良好。 And I think shapes is normally include in the Quick module.我认为形状通常包含在快速模块中。

So I looked at the.so files in my apk and the libQt5QuickShapes.so is not among them.所以我查看了我的 apk 中的.so 文件,而 libQt5QuickShapes.so 不在其中。 There are files like libQt5QuickParticles.so, libQt5QuickTemplates2.so, ... which I do not import explicitly in my applciation, but no shapes.so file.有像 libQt5QuickParticles.so、libQt5QuickTemplates2.so、...这样的文件,我没有在我的应用程序中明确导入,但没有 shape.so 文件。

How to import that shapes module, and.so in my application?如何在我的应用程序中导入该形状模块等? Is it different from other module?和其他模块有区别吗? I thought that androiddeployqt dit that job, but apparently not for all modules.我认为 androiddeployqt 完成了这项工作,但显然并非适用于所有模块。

In my Qt installation, I have the following file:在我的 Qt 安装中,我有以下文件:

./include/QtQuickShapes/5.12.9/QtQuickShapes/private/qquickshapesglobal_p.h
./include/QtQuickShapes/5.12.9/QtQuickShapes/private/qquickshapesoftwarerenderer_p.h
./include/QtQuickShapes/qquickshapesglobal.h
./include/QtQuickShapes/qtquickshapesversion.h
./mkspecs/modules/qt_lib_quickshapes_private.pri
./qml/QtQuick/Shapes/libqmlshapesplugin.so
./include/QtQuickShapes
./include/QtQuickShapes/5.12.9/QtQuickShapes
./include/QtQuickShapes/QtQuickShapes
./include/QtQuickShapes/QtQuickShapesDepends
./include/QtQuickShapes/QtQuickShapesVersion
./lib/libQt5QuickShapes.la
./lib/libQt5QuickShapes.prl
./lib/libQt5QuickShapes.so
./qml/QtQuick/Shapes

So the files for Shapes seem to be there.所以 Shapes 的文件似乎在那里。

EDIT编辑

In my deploy output,I have:在我的部署 output 中,我有:

Reading Android dependencies for Qt5Quick
Appending dependency from xml: qml/QtQuick/Shapes/libqmlshapesplugin.so
Appending dependency from xml: qml/QtQuick/Shapes/plugins.qmltypes
Appending dependency from xml: qml/QtQuick/Shapes/qmldir
-- Skipping /pathToQt/qml/QtQuick/Shapes/libqmlshapesplugin.so. It has unmet dependencies: lib/libQt5QuickShapes.so.
-- Copied /pathToBuildApkFolder/assets/--Added-by-androiddeployqt--/qml/QtQuick/Shapes/plugins.qmltypes
-- Copied /pathToBuildApkFolder/assets/--Added-by-androiddeployqt--/qml/QtQuick/Shapes/qmldir

Does that mean that some dependencies of libqmlshapesplugin are missing (It has unmet dependencies: lib/libQt5QuickShapes.so), so it is not added to apk package?这是否意味着缺少 libqmlshapesplugin 的某些依赖项(它具有未满足的依赖项:lib/libQt5QuickShapes.so),因此未将其添加到 apk package 中? But lib/libQt5QuickShapes.so seems correctly installed with Qt5.12.9.但是 lib/libQt5QuickShapes.so 似乎与 Qt5.12.9 一起正确安装。

In fact, I didn't precise that my project is not developped with QtCreator.事实上,我并没有说我的项目不是用 QtCreator 开发的。 So I had to use an existing json file for android-project-deployment-settings.json, which is normally generated by Qt automatically, and contains a lot of properties for the project ( https://doc.qt.io/qt-5/deployment-android.html#prerequisites-before-running-androiddeployqt ),what I didn't know. So I had to use an existing json file for android-project-deployment-settings.json, which is normally generated by Qt automatically, and contains a lot of properties for the project ( https://doc.qt.io/qt- 5/deployment-android.html#prerequisites-before-running-androiddeployqt ),我不知道。

I used the one which was in my project and it was not updated.我使用了我项目中的那个,它没有更新。 More precisely, the property更准确地说,财产

"qml-root-path": "@QML_ROOT_PATH@" //the path to my qml files

was missing, so the androiddeploy command didn't deploy all the modules for my application but only the default ones.丢失了,所以 androiddeploy 命令没有为我的应用程序部署所有模块,而只部署了默认模块。

So I updated the json file with that property and it's OK, the module "QtQuick.Shapes" is found.所以我用该属性更新了 json 文件,没关系,找到了模块“QtQuick.Shapes”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM