Qt World Summit: Submit your Presentation

QtCreator APK fails to include icon files

  • Hello,

    I'm using QtCreator 4.6.2, Qt 5.10.1 on OpenSUSE Tumbleweed. I created a QtQuick project and added an AndroidManifest.xml file under android-sources. This works as expected and I'm able to use the UI to set various configuration options for the manifest.

    I set custom package name, and set application icons in the manifest, and I notice the res directory gets created with drawable-* directories underneath it, containing the icons I set. I verify the manifest file gets saved correctly in project source directory. So far, so good.

    However, when I build the APK, in the build-* project directory, I see that:

    • res directory only includes the values sub-directory and doesn't include any of the drawable-* sub-directories and icons they're supposed to contain
    • AndroidManifest.xml file doesn't contain the reference to the icon I set in the project source directory
    • AndroidManifest.xml file doesn't contain the correct custom package name I set in project source directory, it's set to org.qtproject.example.myappname
    • The generated APK package also doesn't include the drawable-* sub-directories under res

    The big issue is that I can't set my custom app icon.

    I tried manually adding all the icon files to the project and making sure they show up in the .pro file (along with the manifest file) - this didn't help. I recursive-grepped "org.qtproject.example" in source project directory and found no references.

    I'm unable to find anything on this online. Is there a simple step I'm missing to get the custom app icons and the correct manifest file copied from project source into the build directory and the APK? Has anyone seen and solved this? Thank you.

  • Moderators

    Do you set ANDROID_PACKAGE_SOURCE_DIR to your android-sources in .pro file?

    When you open your manifest file through Qt Creator, does it show the manifest edit page?

  • Aha! Thanks for the tip - I hadn't come across this before. I actually had to set it to

    ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-sources

    It would probably be helpful to add this to https://doc.qt.io/qtcreator/creator-deploying-android.html - which is what I was going off of (wonder how/if I can contribute to online docs).

  • Lifetime Qt Champion

    hi @Unix-One

    you can create a doc bugreport at bugreports.qt.io with a description of your desired change.

    Of course you can do the change yourself, but that requires a Qt Gerrit access and you need to clone the QtCreator repo to create a changeset.

    All together no big deal, but often a hurdle for first time contributors.

    in case you want to try anyway: https://wiki.qt.io/Setting_up_Gerrit


  • Moderators

    @aha_1980 said in QtCreator APK fails to include icon files:

    All together no big deal, but often a hurdle for first time contributors.

    Since a few weeks, Qt Project accepts patches sent via bugreports, too. So setting up gerrit may not be required (although it is still recommended).

Log in to reply