Equivalent of QMAKE_BUNDLE_DATA for android?

  • I have a couple of Qt apps (simple C++ QQuickView hosting a bunch of QML with some C++ plugin components) building and running nicely for OSX and iOS, and including the QML and a bunch of supporting data files (not qrcs) into the app bundles using QMAKE_BUNDLE_DATA in the .pro files. On iOS I can find the location of the app's data files (slightly obscure due to the sandboxing) using QStandardPaths::standardLocations(QStandardPaths::DataLocation), and I have the application cwd to the QML location before it fires up and it all Just Works. (OK ok that does actually sound really hacky now I write it down... ).

    Just been taking my first steps with android. I have a .apk file building... but it doesn't contain any of the files referenced in the QMAKE_BUNDLE_DATA locations (so none of the QML making up the bulk of the application either).

    Is there some Android equivalent of QMAKE_BUNDLE_DATA ("bundle" apparently being Apple-world terminology), or some other approach supposed to be used? Should I just bite the bullet and force all the my QML and data into QRCs?

    I'm using Qt 5.7 and android-ndk-r10e (on Linux, currently) 'cos I saw some messages about later ndk's having some problems.

    Hmmm... I can see another problem brewing that one of the apps bundles around 1GByte of data, which apparently takes me into https://developer.android.com/google/play/expansion-files.html territory. But I'd settle for getting a proof of concept working with less data first.

  • Lifetime Qt Champion


    You can use the assets folder for that. Here you can find how.

    Hope it helps

  • Thanks. That looks promising, but when I try it something seems to be expanding the paths so that if I'm working in in /home/mylogin/project/myapp/, it wants to install files like stuff/myapp.qml to assets/home/mylogin/project/myapp/stuff/myapp.qml rather than just assets/stuff/myapp.qml. Think this is more due my poor knowledge of qmake variable substitution (and when path-like things are expanded?) than anything else; I am actually trying to do


    as I'm trying to reuse the lists of stuff to be packaged I already have from OSX/iOS builds, rather than rebuild a completely fresh list for android on a different macro.
    (It does indeed work as expected if I do a simple
    though. But I don't want to do a huge unmaintainable cut-and-paste duplicate of all the stuff I have being added into QMAKE_BUNDLE_DATA currently, but into INSTALL... at least until I understand why the .path get expanded).

    For now, found a simpler solution in the form of just putting some cp -r <stuff> deploy/assets/ in my build script between the make install INSTALL_ROOT=deploy and the androiddeployqt.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.