There are multiple ways to develop Qt Applications for Android, the easier one is to use the fabulous Qt Creator For Android enabling you to deploy, run & debug Qt and your Qt application on the device. Although if you are more used to CLI using an advanced text editor, or if you want to use another IDE the necessitas framework provides you script you can use to make your Qt for Android projects and to integrate development in command line. Both ways are explained in the subchapters.
Qt Creator is a first class IDE to develop Qt Applications with the different tools it provides. Developing Qt Application for Android with the Qt Creator provided in the necessitas framework lets programmers be productive and enjoy Android application development in C++.
Create a new Qt C++ Project, this can either be a Mobile Qt Gui Projet or a Qt Mobile Application (in this case you will have to remove a small piece of code generated by Qt Creator, which contains references to Qt For Symbian).
Once you choosed the project name Qt Creator will ask you which Qt version to use. It should propose you by default those you configured: android-lighthouse-4.8.0 debug & android-lighthouse-4.8.0 release. Check them if they aren’t and uncheck other Qt Version available.
When your project is created, you are almost done, you will just need to select which android version you target and how you want to deploy the Qt Libs on the device.
Click on the Projects tab : Qt for Android Integration adds here two view: Build & Run.
On the Run view select which Android target SDK you want to use. This provides the different API level which match a specific Android version. You can find more informations about API levels and their agreement to the Android version here.
Note: android-4 API level is the only one which doesn’t support multitouch, so if your application needs multitouch you have to chose a greater one.
In the Manifest thumb you can choose a Package name for your application, indeed the application is launched by an automatically generated java launcher, which will be packed with your application in an .apk (more information about the .apk: Android Application Fundamentals), and an apk has to be in a package.
Figure 1. You can choose the Android target SDK (Android Level API) and the other Manifest informations of you Android Qt application.
On the Application thumb you can choose the icon and the application name.
With the Permissions thumb you can pick which permissions are needed for your application, so that the people installing it, will know what it will do, and that the Android OS will let you access to the required features.
Figure 2. You can easily pick one of the existing Android permissions, or add yourself new ones if you are deploying for a specific Android OS.
The Libraries thumb will offer you an automatic way to determine which Qt libraries you use! Or if needed let you select manually the Qt libraries and the external libraries you think your application needs. These entries will be used by the Ministro tool to determine which Qt libraries have to be downloaded.
Figure 3. This gives to the Java Loader the list of required Qt Libraries and other prebundled libraries, that should get loaded with your application. It also provides to ministro the list of Qt Libraries required.
Always on the Run view you can see the Deploy configurations, there are different options provided to you:
The Use devices qt libs option depends also on the Use local qt libs option. When Use local qt libs is unchecked your application will need the Ministro package to run. However if Use local qt libs is checked, Qt Creator will pass special parameters to the application, forcing it to use Qt libraries from the /data/local/qt path on the device.
The Deploy local qt libs option makes Qt Creator deploy qt libs found in the Qt SDK chosen (e.g. android-lighthouse-4.8.0). This option is useful when you hack on Qt framework to test it.
This option automatically selects the Use local qt libs option. This option get automatically unchecked after Qt Creator pushed the Qt libs. This option can be checked every time you need to push your local Qt modifications. (In fact it makes the same as the push_qt_libs.sh script, which can be found at the root of the Qt for Android Sdk). Checking Deploy local qt libs is not required to be checked to take advantages of the Use local qt libs option.
Install Ministro system option installs the Ministro package (actually it installs any .apk you select :) ) for you. It is useful when you try to test your application on Android Virtual Devices. You can get the Ministro .apk on the Google Market or from here.
Figure 4. The Deploy Configuration of the Projects Run View provides different way to deploy Qt on the Android Virtual Devices following needs
You are done, you can enjoy your development phase. :) You can build and run your application on the device. You will notice that the application output is forwarded in Qt Creator and that you can get interesting debugging information from there, you can also set breakpoints.
This part will be added, as soon as we update the helper scripts for CLI development with Qt on Android.