Important: Please read the Qt Code of Conduct -

QML import error

  • I wanted to create a new QML type from C++ but I encountered a problem in the process, which I couldn't resolve. I have a class in C++ - "Mytype" - which has been registered with the QML Type System via qmlregistertype function.

    So far so good. The class was correctly registered and the application run fine on desktop environments, everything worked fine. However, when I built and deployed the application to an Android device, I received the following error:

    Warning: QML import could not be resolved in any of the import paths: mytype

    What does this error talk about? What could be the reason for this error? How can I fix it? Please, help me. Here follows a simplified code example:

        #include <QApplication>
        #include <QQmlApplicationEngine>
        #include "mytype.h"
    int main(int argc, char *argv[])
        QApplication app(argc, argv);
        qmlRegisterType<Mytype>("mytype", 1, 0, "Mytype");
        QQmlApplicationEngine engine;
        return app.exec();


    import mytype 1.0;
    Mytype {
        id: my_type;