Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-120445

Duplicate qml modules in android_rcc_bundle.rcc and backing target (created by qt_add_qml_module)

    XMLWordPrintable

Details

    • Android

    Description

      If I understand this correctly, a qml module (consisting of qmldir, qml, js, ... files) created by CMAKE "qt_add_qml_module" exists in two places (Android only):

      • Within the Qt resource inside the lib created by the "qt_add_qml_module" backing target. The module is then located under the path "qrc:/qt/qml/<module_name>" (policy QTP0001 set to "NEW")
      • Within the Qt resource created by androiddeployqt (called android_rcc_bundle.rcc). The module is then located under the path "qrc:/android_rcc_bundle/qml"

      How I noticed that a qml module was present twice in my app:

      I removed the "prefer qrc:/qt/qml" statement in the qmldir file created by "qt_add_qml_module" (during development I want the qml files to be loaded directly from disk and not from the backing target - thus I can reload the qml GUI without recompiling the backing target). Then I deployed the App on the Android device using androiddeployqt ("prefer qrc:/qt/qml" still missing in the qmldir file). Then I got this errors in logcat:

      12-29 17:26:15.769 24805 24828 W ONVIFmonitor: [29/12/2023 17:26:15] WARNING  : qrc:/qt/qml/Onvif/Onvif/main.qml:9:1: Type Rally.RallyRootPage unavailable 
      12-29 17:26:15.769 24805 24828 W ONVIFmonitor:      Rally.RallyRootPage { 
      12-29 17:26:15.769 24805 24828 W ONVIFmonitor:      ^
      12-29 17:26:15.769 24805 24828 W ONVIFmonitor: [29/12/2023 17:26:15] WARNING  : qrc:/android_rcc_bundle/qml/MaterialRally/MaterialRally/RallyRootPage.qml: Type Helper unavailable
      12-29 17:26:15.769 24805 24828 W ONVIFmonitor: [29/12/2023 17:26:15] WARNING  : qrc:/android_rcc_bundle/qml/MaterialRally/MaterialRally/Helper.qml:4:1: Script qrc:/android_rcc_bundle/qml/MaterialRally/MaterialRally/helper.js unavailable 
      12-29 17:26:15.769 24805 24828 W ONVIFmonitor:      import "helper.js" as Helper 
      12-29 17:26:15.769 24805 24828 W ONVIFmonitor:      ^
      12-29 17:26:15.769 24805 24828 W ONVIFmonitor: [29/12/2023 17:26:15] WARNING  : qrc:/android_rcc_bundle/qml/MaterialRally/MaterialRally/helper.js: No such file or directory
      [29/12/2023 17:26:15] FATAL    : "Couldn't create GUI: qrc:/qt/qml/Onvif/Onvif/main.qml:9:1 .... 

      as we can see the qml module "MaterialRally" is loaded from qrc:/android_rcc_bundle/qml and not from qrc:/qt/qml, because "prefer" statement is missing and the qml import path "qrc:/qt/qml" has by default the lowest priority of all paths searched by QmlEngine. This is the list of default qml import paths reported by QmlEngine:

      "qrc:/android_rcc_bundle/qml", "/data/app/~~RP1KBvueOeSfhxLFGWBJIg==/com.github.tereius-gf7Mxo0T5S2xB5HnmVYx6w==/lib/arm64", "qrc:/qt-project.org/imports", "qrc:/qt/qml"
      

      If I now reorder the list of qml import paths and move qrc:/qt/qml to the front and deploy the app again, everything works as expected and the helper.js file is actually found (the lowercase is on purpose - the helper.js file should not be directly accessible).

      This leads to several questions:

      • Why is it necessary to have the qml module present twice at two different locations in the app?
      • Both qml modules behave different: helper.js file is missing in the android_rcc_bundle but is present in the backing target. Why?
      • The android_rcc_bundle is nowhere documented. Why is it needed, what does it do?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtandroidteam Qt Android Team
            tereius Bjoern S
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes