Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Error with custom QML module on Android: module "QtQuick.Window" is not installed
Qt 6.11 is out! See what's new in the release blog

Error with custom QML module on Android: module "QtQuick.Window" is not installed

Scheduled Pinned Locked Moved Solved Mobile and Embedded
androiddeploymentqml
3 Posts 1 Posters 5.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Yves MaurischatY Offline
    Yves MaurischatY Offline
    Yves Maurischat
    wrote on last edited by Yves Maurischat
    #1

    Hi,

    I'm developing a custom QML module that contains some custom QML items. One of them is a "MainWindow" type that inherits from the Window QML type (via import QtQuick.Window 2.2). The QML module is installed right into the qml directories of my Qt installation (..\5.5\mingw492_32\qml and ..\5.5\android_armv7\qml respectively).

    When I write an application that imports my module, it works fine on Windows. When I try to deploy and execute it on Android I get the following Error:

    D libandroidmoduletest.so: (null):0 ((null)): [Plugin] initializing engine for "MyQmlModule"
    W libandroidmoduletest.so: (null):0 ((null)): QQmlApplicationEngine failed to load component
    W libandroidmoduletest.so: (null):0 ((null)): qrc:/main.qml:4 Type MainWindow unavailable
    W libandroidmoduletest.so: qrc:/MyQmlModule/MainWindow.qml:2 module "QtQuick.Window" is not installed
    

    It seems that qmlimportscanner doesn't detect the dependency of MyQmlModule to the QtQuick.Window module.

    Any ideas what to do about it?

    1 Reply Last reply
    0
    • Yves MaurischatY Offline
      Yves MaurischatY Offline
      Yves Maurischat
      wrote on last edited by
      #2

      I did some digging and found that adding a QML-file to the application project containing all imports used in the QML Module (library) will add all necessary dependencies to the Android APK.

      QmlDependencies.qml:

      import QtQuick 2.3
      import QtQuick.Controls 1.2
      import QtQuick.Controls.Styles 1.2
      import QtQuick.Layouts 1.1
      import QtQuick.Window 2.2
      import Qt.labs.folderlistmodel 2.1
      import QtGraphicalEffects 1.0
      
      QtObject {}
      

      But I can't help but wonder if there is another way of doing this directly in my custom module? Is there any Qt-conformant way to provide a list of dependencies to the android build that doesn't involve adding a file to all projects that import the module?

      1 Reply Last reply
      0
      • Yves MaurischatY Offline
        Yves MaurischatY Offline
        Yves Maurischat
        wrote on last edited by
        #3

        Turns out that adding the depends keyword to the qmldir file of MyModule did the trick.
        (see also: https://doc.qt.io/qt-5/qtqml-modules-qmldir.html#contents-of-a-module-definition-qmldir-file)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved