Deploying "assets" to Android device
-
I am loading my application "assets" from a sub-directory of the working folder (e.g. "workingFolderPath/res/images"... etc) by creating an URL (e.g. "file:///c:/something/something/workingFolder/res/images/image.png"). Now I want to deploy/test the application to an Android device.
How can I deploy these "assets" to Android device with Qt Creator? I don't want to use Qt resources for that matter. -
Hi,
"Here":https://community.kde.org/Necessitas/Assets for more informations
-
We used a hybrid approach for deployment to Android, which also works cross-platform:
- the QML & JS files are put into qrc files (this also makes sure no one can read your source code)
- the assets are put into an own assets folder and are deployed with DEPLOYMENTFOLDERS += assets in the .pro file
That way, you don't have the size limitation of qrc files (at above ~50MB qrc hangs).
Also, during development working with DEPLOYMENTFOLDERS is better on Desktop, because you can just re-run your application and dont need to recompile.What we did additionally, is to abstract the file access, i.e. you dont need a prefix assets:/... for your images, or mix up your code with any qrc:/... prefixes.
You can have a look at some .pro files of our games by downloading the "V-Play SDK":http://v-play.net and then check out the <QtSDK>/examples/V-Play/demos directory.
I've also posted some comments about the qrc approach set as default since Qt Creator 3.1 on the Qt Blog, maybe that's interesting to the pros and cons of it (and why I think it's bad..):
http://blog.qt.digia.com/blog/2014/03/04/qt-creator-3-1-beta-released/#comment-1193034 -
I don't use qrc too, and this is my code into .pro for deploy to assets for Android:
@
Common data to insert into APK Assets
COMMON_DATA.path = /assets
COMMON_DATA.files = $$files($$PWD/BundleData/Common/*)
INSTALLS += COMMON_DATA
@Then you can access to the data installed using the "assets:/path/filename.ext" as path name.