AAB Support in Qt for Android

Android_Robot

Starting with Qt 5.14.0 beta2, users will notice that there are a lot fewer Qt for Android distributions than in previous versions. But don't panic: All the usual target architectures are still available! Instead of distributing a single package for each target ABI, we now have one larger package that covers all the ones we support: arm64-v8a, armv7a, x86 and x86-64.

For users building from source, the new default is also to build for all target ABIs in one go.

The reason for this is that Google Play is moving away from requiring the upload of multiple publisher-signed APK packages. Instead, the recommended form of distribution now is the new AAB format: An unsigned package that contains all supported target ABIs in one. Based on this, the app store will generate signed APKs that are suitable and optimized for the device issuing the request.

Qt 5.14.0 still supports building APKs, both for release and for local testing, and both with just a single architecture or with multiple if that is your preference. But starting with Qt 5.14.0 we will also support AAB, making the release process a little bit simpler for developers and aligning with the recommendations made by Google. (Thanks, Bogdan Vatra from KDAB for doing this work!)

We think this should be great news for those of you doing Android development with Qt, but since this is a rather significant change, it may also imply a little bit of work for some users, especially those of you who have CI and distribution scripts running, so I wanted to give a heads-up.

First of all: Qt Creator 4.10 and earlier versions will not work together with Qt 5.14.0 and later if you are targeting Android. Qt Creator 4.11 is currently in beta and will be released at the same time as Qt 5.14, so make sure you have that before testing. Command-line building and packaging with androiddeployqt still works as before.

The other thing to keep in mind is that file names of plugins and libraries have all changed to include the target ABI as a suffix. This is in order for the files to co-exist in the same Qt installation, and it may require some changes to packaging scripts or test automation.

As a related change, Bogdan has also altered how plugins are loaded and how additional QML files are bundled together with the app. In previous versions, plugins and QML imports would be unpacked into the directory structure expected by Qt, duplicating some data and adding to the start-up time the first time the app is run. Since Qt 5.14.0, the plugins will now be loaded from the libs directory of the APK directly. In addition, the QML files, which were previously distributed in assets and unpacked together with the plugins, will be included in a Qt resource file that is automatically added to the resource system when the application is launched.

For most applications this should not have any impact, but if you are changing any of the standard Qt binding code, then you may have to adapt it to account for this.

Make sure you also read KDAB's blog on this, which has a lot more technical details and tips.

"The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License."

 


Blog Topics:

Comments