Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-121034

Errors in examples with "qml" directory in QML root when deploying to Android

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • 6.8.0
    • 6.7
    • None
    • Case insensitive filesystem
    • Android, macOS, Windows
    • 2024wk42s3FOQtforAndroid

      Androiddeployqt seems to log these kind of warnings every time it's run.

      warning: Warning: QML import could not be resolved in any of the import paths: QML
      warning: Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Windows
      warning: Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.macOS
      warning: Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.iOS
      

      I've never thought much about it. But in 6.7.0 (betas 1, 2) this has changed and now a build error is raised in some of our examples. This is caused by the first line above, the plain QML one.

      The examples affected are the ones that have a directory named "qml" in the root of the project, or in QT_QML_ROOT_PATH is that has been defined. I used "Qt Quick Examples - Multieffect Item Switcher" here, but others may also have this same behavior - I didn't check everything in the list below.

      > find Examples/Qt-6.7.0 -name "qml" -type d -mindepth 2
      Examples/Qt-6.7.0/quickcontrols/filesystemexplorer/qml
      Examples/Qt-6.7.0/quickcontrols/texteditor/qml
      Examples/Qt-6.7.0/quickcontrols/imagine/automotive/qml
      Examples/Qt-6.7.0/quick/multieffect/testbed/qml
      Examples/Qt-6.7.0/quick/multieffect/itemswitcher/qml
      Examples/Qt-6.7.0/wayland/multi-screen/qml
      Examples/Qt-6.7.0/wayland/fancy-compositor/qml
      Examples/Qt-6.7.0/wayland/custom-shell/compositor/qml
      Examples/Qt-6.7.0/wayland/qtshell/qml
      Examples/Qt-6.7.0/wayland/multi-output/qml
      Examples/Qt-6.7.0/wayland/custom-extension/compositor/qml
      Examples/Qt-6.7.0/multimedia/video/qmlvideo/qml
      Examples/Qt-6.7.0/demos/hangman/qml

      I believe androiddeployqt executes qmlimportscanner to find these missing imports. Now, on a case sensitive file system there is no problem, as it's looking for the qmldir file in a similarly named directory, e.g. QML or QtQuick/Controls/Windows. But on a case insensitive filesystem, like macOS's default one, "QML" == "qml". The scanner thinks it's found the directory that contains this missing import, but can't find the qmldir file in that directory and throws an error about it.

      error: qmldir file not found at "/Users/ollivuolteenaho/Qt/Examples/Qt-6.7.0/quick/multieffect/build-itemswitcher-Android_Qt_6_7_0_Clang_arm64_v8a-Debug/itemswitcher/QML"
      

      This didn't happen in 6.6.x, because the plain QML warning wasn't raised there for some reason.

      It should be easy to test this on Linux too, just rename the directory qml > QML and change all references in CMakeLists.txt in a similar way.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            assam Assam Boudjelthia
            olvuolte Olli Vuolteenaho
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There is 1 open Gerrit change