Note: These are build instructions for building Qt for Android on Linux or Mac OS X. For cross-compiling on Windows, this is currently possible under cmd.exe.
For general information about Qt 5 for Android, please visit the wiki for that.
Building Qt 5 for Android
These are the current build instructions to get to the point where you can deploy a Qt app to an Android device using Qt Creator.
NOTE: Shadow builds are currently broken.
1. First of all you need an Android SDK. You can get the official SDK from Google. Make sure you install both API levels 10 and 11 by using the android tool in the SDK. Android API level 11 is required to build QtMultimedia.
2. You also need an Android NDK. You can use the official NDK from Google, but for full support of all debugging features, please use the customly built NDK at the following location: http://code.google.com/p/mingw-and-ndk/downloads/list
3. Get the Qt Creator source from the “2.7” branch and build it. The released Qt Creator 2.7.0 will not work, as there are required changes in the unreleased version 2.7.1.
4. Get Qt 5:
- git clone git://gitorious.org/qt/qt5.git qt5
- cd qt5
- perl init-repository
5. Configure Qt and skip unsupported modules:
- ./configure -developer-build -xplatform android-g++ -nomake tests -nomake examples -android-ndk <path/to/ndk> -android-sdk <path/to/sdk> -android-ndk-host <e.g. linux-x86_64> -skip qttranslations -skip qtwebkit -skip qtserialport -skip qtwebkit-examples
6. Build. You need a JDK (version 1.6) and you should have this in your PATH. The $JAVA_HOME environment variable needs to be pointing to its directory (e.g. /usr/lib/jvm/java-6-openjdk-i386). Then you can run:
7. Start the Qt Creator you built earlier.
8. Go into Tools -> Options -> Android and set the right paths to the Android SDK and NDK, etc.
9. Add your newly built Qt version to Options -> Build & Run -> Qt Versions.
10. At this point you should be able to create a project and configure it for the Android kit. In order to test, go into the “Run” settings for your project. Under “Deploy Configuration”, check the “Use Qt libraries from local device” option. Also select the “Deploy local Qt libraries” radio button.
11. Now you should be able to connect a device and hit the “Run” button on your project to run it on the device.