How to add a module with a plugin to resource file



  • Hi everyone, I am new in the forum and I have a problem to porting my application to android. I read on several topics that the main work to do is to add everything your application needs to the qrc file, so that all your dependencies will be compiled into the application executable. I am having trouble with one of my plugins. This is how my files look:

    main.cpp
    ...
    engine.addImportPath("qrc:/");
    ...

    qml.qrc
    <RCC>
    <qresource prefix="/">
    <file>main.qml</file>
    <file>qmldir</file>
    ...

    qmldir file
    module MyModule
    MyItem 1.0 MyItem.qml
    plugin MyPlugin

    main.qml
    ...
    import MyModule 1.0

    MyItem{
    }
    ...

    and this is my project directory
    -MyProject
    |---------- > myproject.pro
    |---------- > main.cpp
    |---------- > Resources
    ------------|----------- > qml.qrc
    ------------|----------- > MyModule
    ----------------------------|----------->qmldir
    ----------------------------|----------->MyItem.qml
    ----------------------------|----------->MyPlugin.dll

    The problem is that when i run my application the build goes fine, the application loads the module but not the plugin.
    qrc:/main.qml:6 module "MyModule" plugin "MyPlugin" not found

    The most wired thing is that if I change
    engine.addImportPath("qrc:/");
    in
    engine.addImportPath("C:/path/to/my/project/Resources");
    the application detects the plugin and works perfectly. Any idea to solve my problem to to help me?

    Thanks in advance.



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.