Qt for Android

By Jozef Mlích - Last updated: Friday, November 16, 2012 - Save & Share - 3 Comments

The Necessitas Project deals with porting Qt to Android devices. Achieving this goal is very close. In this article we will describe various aspects of development for Android in Qt.

To understand how Qt works on Android, it is necessary to know some basic principles of Android. The first prerequisite for using Qt for Android is the use of Android SDK and NDK. Software Development Kit (SDK) is a package of tools enabling development of Java applications. Acronym NDK means Native Development Kit. This package includes a C and C + + compilers for Android.

The following diagram is roughly indicating how Qt applications on Android usually work. On the device it is installed Ministro application first, that is set as the dependence of the main application. Application Ministro takes care of downloading individual modules Qt. The actual main application will be then smaller. This method also ensures libraries reusability (the other applications can also use these libraries). The Ministro tells to the main application (when it is started) only the path where Qt is installed, or pulls in missing modules.

Diagram of the application function

On the other side of the diagram it is the application package. To the application there are attached the “loader” and “bridge” which mediate communication with Qt and the device. To obtain data from Dalvik (Davlik is the Java virtual machine in Android) it is apparently used the JNI (Java Native Interface). Usage of the components “loader” and “bridge” is for the Qt application programmer transparent.

Installing the SDK

Qt Creator since version 2.6 has experimental support for the development for Android. After starting it is necessary choose “About Plugins” in the menu “About” and find the plug-in for Android. When it turns on, it appears the item Android in the Settings (menu “Options”).

Necessitas project seeks to simplify development environment installation. On the project website necessitas.kde.org you can download the installation package that will install the Qt Creator IDE (development environment), Android SDK, Android NDK and sets the environment so that it can be used directly.

Android SDK paths in Qt Creator

In the “Devices” tab appears “Android Device”. If Android SDK startup detects the device it installs the package to this device. Otherwise, the Virtual device is started in the simulator window.
One of the problems that can occur during installation is the lack of support for OpenJDK 1.6 in the distribution. For example, Fedora 17 does not have the appropriate packages in its repositories. Apparently it is a patent or a licensing issue with OpenJDK.

http://kojipkgs.fedoraproject.org//packages/java-1.6.0-openjdk/1.6.0.0/65.1.11.fc17
$ rpm -i neco.rpm -- nodeps

Development

For the user interface development it is Qt Quick available. More complex elements of the user interface are not supported. There are relatively simple controls only such as buttons, check and combo boxes. On devices as Symbian or MeeGo Harmattan these elements are included in qt-components. Although there are other “qt-components for Android” too, they are not part of Necessitas SDK. These other components may not meet the User Interface Guidelines for Android.

Permissions settings

Another issue is the functionality of the module Qt Mobility library. Is not easy to tell, if all modules will work properly (as access to a microphone or a camera is likely to be problematic). To make it a try, it is necessary in the project settings (Project -> run -> Package Configuration -> Libraries -> … “) select the appropriate module. Service Ministro then pulls it into the System. In these project settings it can be also set permissions for the application (see figure).

Now we have the fourth Necessitas SDK alpha version, so it still contains a large number of bugs. Nevertheless, it is possible to create interesting programs in C + + using Qt without having to program in Java.

Sdílejte:

Share this:

Posted in Uncategorized • • Top Of Page

3 Responses to “Qt for Android”

Comment from melia biyang
Time 10. 1 2016 at 09:55

Hurrah! In the end I got a blog from where I know how to really get useful information concerning my study and knowledge.

Comment from manfaat binahong untuk kanker
Time 27. 1 2016 at 10:20

Thanks for finally talking about >Qt for Android Openmobility <Liked it!

Comment from Chana
Time 26. 2 2016 at 03:38

Youu do that by requesting a PAC Code from your current community and letting tthe new community knopw this.

Write a comment


Yandex Mail.ru Google LiveJournal myOpenId Flickr claimId Blogger Wordpress OpenID Yahoo Technorati Vidoop Verisign AOL