A couple of days ago the Qt Project released the first beta version of Qt 5.1 including pre-build binaries for Android. Time for us to have a closer look.
Having pre-build binaries allows us to quickly test out Qt without first compiling our own version. So today we’ve ported the Qt-based game Plonk to Android basically without touching the code. Here we’re going through the first steps and giving some insight based on our experience.
Setting everything up
Lets assume you already have an Android SDK installed, your device is configured to work with it etc… All you have to do now is:
- Install ant and make sure it is in your path
- Install the Android NDK. Currently only versions below “r8e” are supported. We used version “r8b”
- Download Qt for Android here: http://download.qt-project.org/development_releases/qt/5.1/5.1.0-beta1/
- Install Qt and run QtCreator as usual
Now inside QtCreator first go to Tools -> Options -> Android and fill out the SDK, NDK and OpenJDK locations. After that Qt versions, compilers and kits are filled out automatically. You can check those settings under Tools -> Options -> Build & Run.
At that point your environment should be properly set up. Now create a new QtQuick 2.0 application. And open the Projects tab. There add a kit if needed and click on the run settings.
Here expand the Package configurations section and fill in meta-data about your app. Like version, target SDK, etc. Those settings will end up in your Android Manifest.xml.
That basically should be all. Now compile and run your application and have fun. Of course there might be some glitches as this is still a pre-release but all in all it worked quite well for us.
What doesn’t yet work
Even though parts of QtMultimedia are supposed to be supported we couldn’t get it working. QtMultimediakit 5.0 is still missing completely and using the C++ classes for SoundEffect did compile but didn’t output anything. We only tried for about half an hour, so this might as well be our fault.
Creating a signed APK was easy enough, unfortunately QtCreator does not yet support packaging the Qt libs directly into the APK. Instead if the app gets started for the first time the needed libraries are downloaded from the internet if not yet available on the device.
Besides some minor issues that probably will be fixed in Qt 5.1 final or 5.2, the Android support is already quite mature and surprisingly painless. We have been able to get the multi-touch game Plonk running on a Samsung Galaxy Nexus within half an hour. Including hardware accelerated QtQuck 2.0 with particles and multi-touch. Regarding performance we had no issues either. The game play is nice and all animations are really smooth.
For us it is currently not yet ready for production, but certainly stable enough to do some porting and development for things that might get released within the next couple of months. All in all quite impressive!
To give you a concrete example we’ve uploaded the current version to Google Play, so you can have a look for yourself. Please note, this has only been tested on a Samsung Galaxy Nexus phone. If it works for you on a tablet, please send us a screenshot