From Build – Android – APK Settings we can ‘Create Templates’.
What does this mean ? Qt uses some templates for Gradle Properties, a Default Manifest and more to do the build.
If building some Example Apps you can use them as they are, but for real Apps, it’s good to know what exactly was used to build, so let’s take a look on it and hit ‘Create Templates’

You’ll be asked where to store them – I always use the default – the android directory of your project:

If all was ‘Done’ you’ll find some files inside the android directory:

Update existing Templates
If you already have created Templates for an earlier Qt Version, you’ll be asked if you want to update.
Attention: For me with QtC 9.0.2 the ‘Yes to All’ doesn’t work, so it’s better to explicitely confirm for each single file.

Check DIFFs
Overwriting all Templates only is a good idea if you’re using a Version Control System (GitHub or so), to see what was changed:

In my case I updated Templates from Qt 5.15.7 to Qt 5.15.13. Some important changes to know:
build.gradle updated gradle from 3.6.0 to 7.0.2

Because gradle has changed from 3.6 to 7.0 now a newer JDK is required. Up to Qt 5.15.7 I have used JDK 8. Now with Gradle 7 I switched to JDK 17 (JDK 11 also works – have tried this with 5.15.12). Changing JDK at Preferences – Devices – Android all works well again.
gradle-wrapper.properties also has updated for gradle:

Check Manifest Header
Now the most important infos about changes in Android Manifest.
Of course out previous changes to Manifest in 5.15.7 must be redone for the new default Manifest:
- Package name
- Application Name
- Activity Name
Important: Minimum required SDK and Target SDK have been removed from Manifest, you shouldn’t set the values anymore. Min SDK and Target SDK are now defined as part of your .pro:
ANDROID_MIN_SDK_VERSION = "21"
ANDROID_TARGET_SDK_VERSION = "31"

Redoing our changes, the Manifest Header now looks this way:

Check Manifest XML
There’s not only the Default Manifest Editor, but also an XML editor to fine-tune the Manifest.
Let’s see what was changed:

It’s a good idea to see which elements are removed, new or changed. If you don’t know what a specific element means, this Android Developer Page will help you.
- removed
- android:extractNativeLibs=”true”
- added (new)
- android:allowNativeHeapPointerTagging=”false”
- android:allowBackup=”true”
- android:fullBackupOnly=”false”
- android:icon=”@drawable/icon”
- android:exported=”true”
it’s up to you to check what all these elements are doing – see the link above 😉
You must be logged in to post a comment.