Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Cmake + FelgoLive + Android

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #24570

    Pavel

    Hi Felgo Family!

    I’m trying to build Qml application based on Cmake build system and run FelgoLive directly on Android device.

    I spent several days investigating several issues and finally I think I have almost working solution – app starts, plugins loading correctly, but it looks like there is some problem with QML module paths resolving, I described error content below:

    W Felgo Live Client: QCoreApplication::postEvent: Unexpected null receiver
    W Felgo Live Client: Warning: QQml_colorProvider: no color provider has been set!
    W Felgo Live Client: qrc:/src/ErrorScreen.qml:7:12: Invalid property assignment: color expected
    W Felgo Live Client: color: "#fff"
    W Felgo Live Client: ^

    Looks like ErrorScreen.qml is an internal content of FelgoLive. Does Felgo have working Cmake examples? Or could you please help me with this kind of error?

    Kind regards,

    Pavel

    #24571

    Alex
    Felgo Team
    #24574

    Pavel

    Hello Alex, Thank You for response!

    Yes, I started my investigation with this example, but it doesn’t work out of the box. I’m getting app successfully compiled, but after it sends me to Live Reload screen on my Android device it shows Felgo based QML window with error log:

    An error occured, please check the log output for details!
    
    qrc:/qml/Main.qml:16:1: module "QtCharts" is not installed
    
    qrc:/qml/Main.qml:12:1: module "QtQuick.XmlListModel" is not installed
    
    ...

    It looks like FelgoLive_arm64-v8a.so can’t find dependencies of it’s root QML file – we can see all the dependencies here Qt/5.15.2/android/mkspecs/common/felgo/FelgoLive/Imports.qml

    I spent a few days researching the problem and tried many different things with no success.

    I have these strings in CMakeLists.txt to make Felgo and Felgo Live work:

    set(PRODUCT_IDENTIFIER CACHE STRING "com.myapp.test")
    set(PRODUCT_VERSION_NAME CACHE STRING "1.0.0")
    set(PRODUCT_VERSION_CODE CACHE STRING "1")
    set(PRODUCT_LICENSE_KEY CACHE STRING "felgo-license-key-here")
    
    find_package(Felgo REQUIRED)
    find_package(FelgoLive REQUIRED)
    include_directories(${Felgo_INCLUDE_DIRS})
    include_directories(${FelgoLive_INCLUDE_DIRS})

     

    Also to make find_package function work I was needed to make some changes in Qt internal cmake scripts(I know it’s a bad practice, but I want to achieve a simple MVP with Hot Reloading on Android device first).

    Standart Felgo qmake template (https://github.com/FelgoSDK/QtQuickFelgoLiveExample-qmake) with Felgo Live enabled works for me out of the box so my final thoughts were to compare Android build system artifact outputs for Cmake and Qmake examples.

    I found out that final “android-build/libs” directory for Qmake template consists of 138 different libraries, but Cmake version consist of only 118 libraries and it looks like this difference is exact the missing libs or plugins!

    libcrypto_1_1.so
    libssl_1_1.so
    libqml_qt3d_core_quick3dcoreplugin_arm64-v8a.so
    libqml_qt3d_extras_quick3dextrasplugin_arm64-v8a.so
    libqml_qt3d_input_quick3dinputplugin_arm64-v8a.so
    libqml_qt3d_logic_quick3dlogicplugin_arm64-v8a.so
    libqml_qt3d_render_quick3drenderplugin_arm64-v8a.so
    libqml_qt_labs_folderlistmodel_qmlfolderlistmodelplugin_arm64-v8a.so
    libqml_qtbluetooth_declarative_bluetooth_arm64-v8a.so
    libqml_qtcharts_qtchartsqml2_arm64-v8a.so <<<<<<<<------- qrc:/qml/Main.qml:16:1: module "QtCharts" is not installed
    libqml_qtdatavisualization_datavisualizationqml2_arm64-v8a.so
    libqml_qtnfc_declarative_nfc_arm64-v8a.so
    libqml_qtquick_dialogs_dialogplugin_arm64-v8a.so
    libqml_qtquick_dialogs_private_dialogsprivateplugin_arm64-v8a.so
    libqml_qtquick_privatewidgets_widgetsplugin_arm64-v8a.so
    libqml_qtquick_scene3d_qtquickscene3dplugin_arm64-v8a.so
    libqml_qtquick_xmllistmodel_qmlxmllistmodelplugin_arm64-v8a.so <<<<<<<<------- qrc:/qml/Main.qml:12:1: module "QtQuick.XmlListModel" is not installed
    libqml_qtsensors_declarative_sensors_arm64-v8a.so <<<<<<<<------- qrc:/qml/Main.qml:12:1: module "QtSensors" is not installed
    libqml_qtwebsockets_declarative_qmlwebsockets_arm64-v8a.so
    libqt53danimation_arm64-v8a.so
    libqt53dquickextras_arm64-v8a.so
    libqt53dquickinput_arm64-v8a.so
    libqt53dquickrender_arm64-v8a.so
    libqt5datavisualization_arm64-v8a.so
    libqt5xmlpatterns_arm64-v8a.so

     

    I decided to try to add these libraries manually. I created Android template with custom AndroidManifest.xml file, “libs” and “resources” folder.

    The first thing I found after building the project – if I run QtQuickFelgoLiveExample-cmake original example without “android” folder (by cloning and running) the resulting application and main activity names are:

    android:name="org.qtproject.qt5.android.bindings.QtApplication"
    android:name="org.qtproject.qt5.android.bindings.QtActivity"

    but as I understand they should be Felgo wrappers for these classes:

    android:name="net.vplay.helper.VPlayApplication"
    android:name="net.vplay.helper.VPlayActivity"

     

    By comparing these examples I made the outputs completely similar if open them in Android Studio after building in Qt Creator.

    So the errors with missing libraries are gone. And then it shows the error which I described in the head message of this topic, but it looks like it’s FelgoLive internals and I’m not allowed to change it and fix this error.

    Also I have another idea – running these lines of Qmake example *.pro files moves all “qml” folder(with *.qml files and config.json file) to Android Studio project assets folder. I don’t understand exactly why we need this, but I guess it may be related to qml dependencies resolving mechanism. Maybe I need to make some similar step for Cmake project?

    qmlFolder.source = qml
    DEPLOYMENTFOLDERS += qmlFolder # comment for publishing

     

    Also maybe this one is related?: https://felgo.com/developers/forums/t/qtcharts-doesnt-work-in-felgo-live

     

    Thank you!

    #24575

    Alex
    Felgo Team

    Hi Pavel,

    providing full CMake support for Felgo builds is on our roadmap, but not yet available.

    Your posted link is not related, this was just a missing module in the live client years ago.

    The deployment folders are an “alternative” for the Qt resource system (qrc), where the contained files are copied to the application bundle without packaging them into the resources. Your application should also work without the deployment folders, but only if everything is moved to the resources then.

    For Felgo Live specific building steps, you may also check out this file in your installation: <Path to your installation>/Felgo/android/mkspecs/features/felgo-live.prf

    Is there a specific reason that you need CMake support for your current project?

    Best,
    Alex

    #24582

    Pavel

    Hello Alex, Thank you for an explanation! Yes, I prefer to use Cmake for my projects, but it is not necessary right now. Hot Reloading with Felgo saves a lot of time so since I need it as soon as possible I think I can support both Qmake(for Qmake Hot Reloading works) and Cmake until Felgo and Qt will work on 6th version which haves Cmake as a main build tool. Thanks!

     

    Best regards,

    Pavel

    #24893

    Cezary

    Hi, Pavel

    Seems You already went path I just starting now…

    How You make Felgo loaded by CMake properly?

Viewing 6 posts - 1 through 6 (of 6 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded