Search code examples
androidqtqmlqt5qtquick2

QML android application using QtQuick.Shapes, module not found


I have a Qt 5.12.9 qml android application. It works well but I have to "import QtQuick.Shapes 1.12" in a file and with it, at execution I get:

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. 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. There are files like libQt5QuickParticles.so, libQt5QuickTemplates2.so, ... which I do not import explicitly in my applciation, but no shapes.so file.

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.

In my Qt installation, I have the following file:

./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.

EDIT

In my deploy output,I have:

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? But lib/libQt5QuickShapes.so seems correctly installed with Qt5.12.9.


Solution

  • In fact, I didn't precise that my project is not developped with 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.

    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.

    So I updated the json file with that property and it's OK, the module "QtQuick.Shapes" is found.