QML files not deployed/found on Android
-
My project has a qrc which lists the qml files I use. When I deploy and run to an Android device it seems that the qml files are not there.
W/gui ( 9855): qrc:///main.qml:-1 ((null)): default: warning: unknown: qrc:///main.qml: File not found
During the build process I get a lot of messages like this:
-- Adding '/home/anr/src/gui/Gui.qml/windows' as QML dependency
-- Skipping because file does not exist.Do I need to handle the qml files in my project in a special way for deployment to Android?
Edit. I'm using Qt 5.7.1, NDK r10e, SDK r25.2.5 and Qt Creator 4.3.1.
-
Inspecting the APK I see none of my QML files in the assets folder.
-
I think this may be what I'm struggling with: https://bugreports.qt.io/browse/QTBUG-55259
-
Last reply to myself for the day :)
Since the qml files are added to a qrc file, they should be embedded into my application. Have to qrc files, both added with "RESOURCES+=" in pro/pri files.
I added this code to my application to see what was inside:
QDirIterator it(":", QDirIterator::Subdirectories); while (it.hasNext()) { qInfo() << it.next(); }
The resources from one of them are added to my application, the resources from the other is missing. From the Makefiles in my shadow build directory the two qrc files seem to be treated the same.
-
@torpeanders I always use just one resource file per project, and although not completely sure, it looks like having RESOURCES += ...
is intended for just one resource file.
I'm not sure if you need two resource files, I'd ask what is your use case for that, please remember that you can have subfolders to split just in case; i.e. I usually have a subfolder images for the icons and a subfolder translations and then it's a question of using the proper pathQIcon(":/images/cut.png")
So if even this trick cannot avoid you having two resource files, please have a look at the documentation as it explains how to create/deal with external resource files (it'll be your 2nd one).