[Tutorial] How to use Qt Creator for mobile development - Android [Updated Feb/2015]
In this tutorial, I’m going to show you how to use Qt Creator(now on 5.4) with Android.
I - Requirements
In order to use Qt for Android, you need the following:
- The Android SDK Tools
- The Android NDK
- Apache Ant v1.8 or later
- Java SE Development Kit (JDK) v6 or later. You can also use OpenJDK on Linux.
- On Windows, you need the following additional installations:
- MinGW v4.8.0 revision 2
- Android Debug Bridge (ADB) driver on the Windows platform to enable USB debugging. The default USB driver on Windows does not allow debugging. For details about how to get the USB driver, see http://developer.android.com/sdk/win-usb.html.After installing the driver, try running a few basic adb commands and check whether your device responds to it.
You need to have the PATHs configured, to Qt be able to use Android tools and Java compiler.
The requirement process can be annoying, but you can find tutorials about it almost everywhere. If you have problems, just comment.
If you have never used Android SDK, you must to download at least one android API. To do it:
- open your Android SDK folder
- open tools folder(inside SDK folder)
- run the file android(or android.bat on Windows)
- In the screen bellow, select one Android API(Android 4.4.2 in my case), and click in the button Install * packages…
Now, you are able to start!!
II - Installing Qt for Android
Qt 5.4 Highlights:
Let’s start the installation. Go to Qt Project website and download the Qt for Android.
Click in the button View All Downloads to find others packages.
Select you platform, download and install Qt 5.4 for Android.
III - Configuration
Open the Qt Creator, and go to Tools -> Options… -> Android and fill the required fields, like SDK, NDK, JDK and Ant PATH. If you want to, you can manage your devices in the same screen, selecting a real one or configuring a virtual one.
IV - Creating your first application
To create a new project, open File -> New File or Project -> Applications -> Qt Quick Application -> Choose,
if everything if fine, you will be able to select Android in this screen.
Create the project, and choose Android in build kit selector:
Now, just run your application. If everything is fine, you will be able to select the device(emulator or real one) and run your application.
If you have some problem here, just comment that I you try to help you.
I’m going to create more tutorial about Qt for Mobile Development with Android, so keep connected with the blog. I’m going to show you how to create games, application and more.
That’s all, thanks for reading, feel free, just comment your experiences with this tutorial.