Qml deploiment to Android, in a sub project architecture



  • Hi there !

    I've run into quite the pickle, I'm deving an app that's quite large, meaning that I want it to be unit tested so I divided it in 3.

    projectName/
    ├── app/
    │   └── app.pro (lib template)
    ├── projectName_app.pro (<- subdir template )
    ├── run/
    │   └── run.pro (app template, containing the main)
    └── tests/
        └── tests.pro (test template)
    
    

    I have 99% of my code, qrc included, in a lib qmake template (called 'app') , that's gets linked against a run (app template) project and against a test project.

    All that works fine on Desktop (Linux/Win) but trouble arrives when I try to deploy to Android, I'm getting messages saying that all my QtQuick imports of the top of my Main.qml aren't found....

    D OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
    I OpenGLRenderer: Initialized EGL, version 1.4
    D librun.so: Worker lost/didn't have a open connection to work !
    W librun.so: QQmlApplicationEngine failed to load component
    W librun.so: qrc:/app/main.qml:3 module "QtQuick.Layouts" is not installed
    W librun.so: qrc:/app/main.qml:2 module "QtQuick.Controls" is not installed
    W librun.so: qrc:/app/main.qml:1 module "QtQuick" is not installed
    W librun.so: qrc:/app/main.qml:3 module "QtQuick.Layouts" is not installed
    W librun.so: qrc:/app/main.qml:2 module "QtQuick.Controls" is not installed
    W librun.so: qrc:/app/main.qml:1 module "QtQuick" is not installed
    W librun.so: qrc:/app/main.qml:3 module "QtQuick.Layouts" is not installed
    W librun.so: qrc:/app/main.qml:2 module "QtQuick.Controls" is not installed
    W librun.so: qrc:/app/main.qml:1 module "QtQuick" is not installed
    02-06 04:08:52.496  2802  2815 W librun.so:
    W librun.so: exit app 0
    
    
    "org.qtproject.example.run" died.
    

    I tried deploying while having only the app project (moving my main.cpp there), works like a charm, but it kinda defeat the whole point.

    How can I tell the whole blockchain to handle the Qml imports correctly, while keeping that architecture ?

    EDITS:

    1. Wild guess, I feel like androiddeployqt is supposed to do the job, copying qml files to the asset folder, but I doesn't do it in my configuration
    2. ANDROID_EXTRA_PLUGINS looks interesting too

    Looks like I can trick androiddeployqt into copying qml files needed, by adding a file at run folder's root:

    #imports.qml
    
    import QtQuick 2.12
    import QtQuick.Controls 2.5
    import QtQuick.Layouts 1.12
    
    Item{
    
    }
    

    But it doesn't work all the way, some dependencies further down the way doesn't get resolved...
    (And it's pretty ugly ^^")

    Cheers ;)

    (this is a repost, from QML sub forum)


Log in to reply