QT 5.1 and Android
By andre
You might have heard, that Trolltech has recently released a new version of their famous QT library with preliminary support for Android and iPhone (iOS) support. This is, actually, pretty exiting news, because it means that, at least in theory, one can have a single mobile application code base for two most popular smart phone platforms on today’s markets. And, possibly, for most desktop computers as well, because QT runs pretty well on Windows, Linux and Mac. Throw in support for QNX / BlackBerry 10, which QT also provides, and the prospects become almost irresistible.
So I decided to give this a try. I followed the compiling and deployment instructions from this page . As usual, such things are never perfect and I ran into a few missing points, which I want to share with you.
First, my config command. Target system - Ubuntu 13.04 64 bit, GCC 4.7:
./configure -developer-build \
-xplatform android-g++ \
-nomake tests -nomake examples \
-android-ndk path-to-android-ndk \
-android-sdk path-to-android-sdk-linux \
-android-ndk-host linux-x86_64 \
-skip qttranslations \
-skip qtwebkit -skip qtserialport -skip qtwebkit-examples
Observations and notes:
- You have to use the the NDK linked from the instruction page, the one I downloaded directly from Google didn’t work
- You’d better download Android rev 10, because this is what the build process wants to use by default. In theory, you could specify an alternative one via an environment variable, but at this early stage, do you really want to mess up with this unstable system?
- You can’t really move your build around, unfortunately. A lot of output files have hard-coded pull paths in them, so if you do relocate our final result, nothing will work and you won’t be able to build anything
- When you add the newly built QT to QTCreator, as advised in the instructions, some error messages will be visible, telling you that no compiler was available to generate output for “this” platform. I am not sure what “this” means in that context, but I am able to successfully build and run a sample project
I will continue to add more gotchas as I discover them along the way.