diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 9f7ab72f0bf..d45a4a5784f 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -1892,12 +1892,22 @@ bool scanImports(Options *options, QSet *usedDependencies) #endif QStringList importPaths; - importPaths += shellQuote(options->qtInstallDirectory + QLatin1String("/qml")); + // In Conan's case, qtInstallDirectory will point only to qtbase installed files, which + // lacks a qml directory. We don't want to pass it as an import path if it doesn't exist + // because it will cause qmlimportscanner to fail. + // This also covers the case when only qtbase is installed in a regular Qt build. + const QString mainImportPath = options->qtInstallDirectory + QLatin1String("/qml"); + if (QDir().exists(mainImportPath)) + importPaths += shellQuote(mainImportPath); + + // These are usually provided by CMake in the deployment json file from paths specified + // in CMAKE_FIND_ROOT_PATH. They might not have qml modules. for (const QString &prefix : options->extraPrefixDirs) if (QDir().exists(prefix + QLatin1String("/qml"))) importPaths += shellQuote(prefix + QLatin1String("/qml")); + // These are provided by both CMake and qmake. for (const QString &qmlImportPath : qAsConst(options->qmlImportPaths)) { if (QDir().exists(qmlImportPath)) { importPaths += shellQuote(qmlImportPath);