Eskil Abrahamsen Blomfeldt

Preview of Qt 5 for Android

Published Wednesday March 13th, 2013
55 Comments on Preview of Qt 5 for Android
Posted in Qt, Qt Quick 2.0

The first commit in the effort to port Qt 4 to Android was on Christmas Day, 2009: “Android mkspecs and semaphore” by BogDan Vatra.

On January 22nd, 2010, he committed “A small step for Qt, a giant leap for android” with a working graphics system plugin and could actually run Qt applications on an Android device. He uploaded a video to celebrate.

On February 20th, 2011, he announced the first usable release of Qt 4 for Android, under the moniker of Necessitas.

For the past 3+ years, BogDan and others have been (and are still) developing Necessitas on their spare-time, and on November 8th, last year, BogDan agreed to take his work into Qt 5 and submit the port to the Qt Project.

He pushed the first version of Qt 5 for Android to a WIP branch on January 4th, and recently we integrated into the “dev” branch, meaning that it will become part of Qt 5.1 when it is released.

For this preliminary release, we are focusing on the developer experience, working to enable Qt developers to easily run and test their applications on Android devices. While there’s nothing preventing you from deploying your app to an app store with Qt 5.1, we’re recommending that people wait until Qt 5.2 before they do that, as we’d like to put some more work into improving that experience: Making more options for how your app is deployed, adding more polish in general, and adding more support for Android APIs, both by allowing you to extend your app with Java code or by mapping them in C++ APIs, whichever makes the most sense.

On to the demos!

To start off, here’s a video of the Qt 5 Cinematic Experience demo running on (from left to right): a Nexus 4, an Asus Transformer Pad TF300T and a Nexus 7. The Cinematic Experience demo has quickly become our demo of choice at events, because it nicely shows a lot of the new graphical capabilities in Qt Quick 2, such as shader effects, particle effects, the new PathAnimation as well as the hardware-accelerated SceneGraph architecture underneath, which makes it possible to run all this at 60 fps.

Click to see video

In addition to the core parts of Qt, we also support the QML media player APIs in QtMultimedia. Here’s a nice video player written by Andy in QML, with fragment shader effects on top of the video, running on an Asus Transformer TF300:

Click to see video

To show off multi-touch support, here’s a simple hand painting demo running on a Nexus 4. This also shows the support for native menus:

Click to view video

The lowest Android API level supported by Qt 5 is API level 10, aka Android version 2.3.3. This means we can also have Qt apps running on reasonably priced devices, such as this Huawei Y100:

Click to view video

Here’s the overview of what we have right now:

  • Support for creating Qt Widgets and Qt Quick apps that run on Android devices.
  • Support for Android API level 10 (version 2.3.3) and up.
  • QML media player functionality in QtMultimedia.
  • A set of commonly used sensors in QtSensors.
  • Cross-platform features of Qt of course (including Qt Quick controls and QtGraphicalEffects.)
  • Developing and configuring apps in Qt Creator 2.7.
  • Deploying a test build to a device directly from Qt Creator.

In addition, we plan to soon support the possibility of distributing the Qt libraries through the Ministro distribution tool, which allows you to share a set of Qt libraries across several apps on a device, and which will be the primary way of deploying apps with Qt 5.1. Other than that, this is all already available: Just check out the wikifor instructions. Let us know if anything goes horribly wrong. We can usually be found in the #necessitas channel on the Freenode IRC servers.

What’s next, you ask? You can in fact help us decide! Both by reporting your bug findings and feature expectations to us, and by contributing your code. We will be working steadily on improving Qt 5 for Android, and would benefit greatly from your feedback. In the wiki, we are also compiling a list of devices where Qt has been verified to run. If you take the time to add devices you have tested to the list there (as well as any issues you have found), it would very much be appreciated 🙂

Finally: A big thanks to BogDan Vatra, Ray Donnelly and everyone else who has been contributing to the Necessitas project for the past years, as well as Qt 5 for Android in the past months. And thanks to everyone who will contribute in the future.

Do you like this? Share it
Share on LinkedInGoogle+Share on FacebookTweet about this on Twitter

Posted in Qt, Qt Quick 2.0


smoggy says:

Amazing werk !

A note, for Qt Commercial it will be useful to deploy modified qt libraries by ministro or any other means.

1) will it be possible to invoke android intents ?

2) will it be possible to have multiple windows, or only single maximized window ?

Alexey says:

Use JNI force

eslam says:

^_^ Great

Eskil Abrahamsen Blomfeldt Eskil Abrahamsen Blomfeldt says:

Smoggy: I believe the next Ministro version will support downloading libraries from a location specified by the application, so that the same system can be used to manage your customized Qt libraries.

1) This is one of the topics we plan to look more closely at in the time to come. At the moment, you will have to extend the Java code to use most of the Android-specific APIs which do not map to Qt APIs.

2) Currently we only support a single fullscreen window.

roywillow says:

If different apps are using different customized Qt libraries, maybe users will have to download all of them to their device, so they will consume much space. This will be quite unpleasant, especially those doesn’t have too much memory space…

trusktr says:

Hey, on iPhone apps can only have statically linked libraries, so Android is better of already. We can’t complain about this really if we compare to iPhone… But who likes iPhone? lol

Filippo says:

i experienced a really annoing bug using the asus transformer with the last Necessitas release: a flickable view freeze (stops flicking) if my finger touch the android bar. IMHO seems like the finger release event is stealed by the android bar! this doesn’t happen if on the other edges

Paul Olav Tvete says:

This has been fixed for Qt5:

Filippo says:

Awesome!! 🙂

rahul garg says:

Great news! Three questions:

1. Wondering whether QtOpenGL is supported as well?
2. And what about Qt Quick 2?
3. Assuming QtOpenGL is supported, is there a performance hit compared to, say, using raw EGL+OpenGL code?

Eugene says:

Sorry for dump question, but: is it possible to download it and try (for win/linux). I can’t find links in article.

Mohsen says:

I never liked Ministro way of deploying Qt libraries into the device. Qt must have its usual road just like it was for WinCE and Embedded Linux. Taking libraries together with application installer package is the right solution; otherwise don’t waste your time. wouldn’t get compete.

Cyttorak says:

Will it be possible to create stand alone (without the need of ministro) applications? Or at least hide somewhat ministro instalation? It is very odd for the user to install an app that asks for another one.

divide says:

Does it support audio stream or should we wait Qt 5.2?

DeakBlue says:

This is great on YouTube, but please please please get a version onto the Android Market so we can see what these apps look like. No one will mind if it’s not “gold” yet or if it’s a little shakey, but we are desperate to touch and play with it. Now is the time when we, developers and project leads, are making technology decisions for product releases 12 and 24 months from now!

Eskil Abrahamsen Blomfeldt Eskil Abrahamsen Blomfeldt says:

rahul: QtOpenGL (as in QGLWidget) also works, as well as Qt Quick 2. All the videos in the blog (except the finger painting app) are of Qt Quick 2 apps.

Eugene: Currently, the way to try it is to download the source code and build it yourself. There are links to our wiki in the blog post, and there you will find build instructions.

Mohsen, Cyttorak: I agree that having alternatives to Ministro, such as bundling libraries with the app, is important for many use cases, and this is one of the things we plan to focus on for Qt 5.2. Making a standalone app at the moment will require a bit of manual work, but it can be done. The easiest would probably be to build statically.

divide: Right now, only media player functionality is supported, which goes through Android’s media player. There’s work in progress for the other parts of the APIs, but the feature freeze is coming up, so they will most likely not be a part of Qt 5.1.

DeadBlue: We plan to put some demos in Google Play as soon as possible.

Mohsen says:

Thanks for clarifying.
static linking not thoughts to be the solution too. i don’t completely know the licensing terms for statically linking Qt libraries but as it seems it’s not permitted for OpenSource usage.
thinking of the Ministro trick of defining the libs path in environment variable would be a method if the Qt5 Android still picks java as its runtime backend instead of native way. (because of needing to check versions which was solved by Necessitas manifest)
having multiple Qt builds for different platforms is very common as well as for WinCE users. so it wouldn’t be a reason to ask users to download libraries through the Ministro.

honestly say it thoughts to be a trick to divide Qt Android version into a BAD OpenSource mode and a GOOD commercial one.

Eskil Abrahamsen Blomfeldt Eskil Abrahamsen Blomfeldt says:

While this is not really my area, as far as I know static linking is fine for open source apps. The restriction is on making a closed-source application which is statically linked against an LGPL library, because the LGPL requires that you provide users with a way of relinking the application against a new version of the library. For those cases, you will have to make the object files available so that people can relink the application. But I’m no expert, so please don’t take my word for it. There should be numerous discussions about this on the web which might be helpful to you.

If static linking does not work for you, I think right now the solution would be to bundle all the Qt libraries and plugins in the lib/ folder of your APK. It should be easy enough to load the Qt libs, but you would have to make the code copy the plugins from your apk into a different directory the first time it starts, duplicating the directory structure required by the plugin system and then setting the plugin path. I know that there are people who have already tried this and have made it work with the current Qt 5 code, but as I say in the blog, this is not a supported deployment mechanism at the moment, so it requires manual work on your part. This is one of the things we’ll look at improving later on.

Cyttorak says:

Well, if it is possible to bundle Qt libraries in app folder somehow it would be a nice solution. In this case my only concern is library size, Qt weights a lot of megabytes 🙁

Mohsen says:

hmmm now it makes sense

xuxiang says:

You said:
“Right now, only media player functionality is supported, which goes through Android’s media player.”
I am really interested, as my app need to remove the QMediaPlayer to compile on Necessitas and I can’t provide the multimedia feature to my users.
Can you show me a link to an example which use Android’s media player within Qt?

Yoann Lopes says:

QMediaPlayer uses Android’s media player internally. You can simply re-enable the QMediaPlayer code in your app. (Note that video playback is only available with QtQuick 2 at the moment, not with QVideoWidget)

xuxiang says:

It’s a “WOW” feature as I’ve been waiting for 2 years on this!

Kalileo says:

This is great news! Especially the media player functionality. I had been waiting for this for a long time.

Keep it coming, please!

Scorp1us says:

Is there any word on Qt3D for Android?

Eskil Abrahamsen Blomfeldt Eskil Abrahamsen Blomfeldt says:

It’s not something we’ve looked at so far, but I’m not really expecting any huge obstacles for making it work.

Thomas says:

Bundling libs with the app will be key to user friendly development, hope to see that feature in Qt 5.2.

M.S. Babaei says:

I’ve been waiting for so long to see official Android support around. THANKS!! 🙂

Jan Faroe says:

Good stuff indeed. However, as a desktop developer, I am wondering if most efforts are being directed towards mobile platforms? I’m struggling with bugs that has been reported ages and ages ago, many of which has been either unassigned or ignored. I left Java Swing in the hope that Qt might be the better choice; it’s not that I regret it (Desktop Java is dead and buried and I love Qt in general), but from my point of view desktop GUI fixes (specifically on the Mac platform) seems abandoned or at least with a low priority.

Fix issues in backlog first, then move on would seem like a wise strategy.

danny says:

Welcome to the club. Qt has always been weak on Mac, even before Nokia. It didn’t help that Qt 4.6 broke a *lot* of things that previously worked in 4.5.

Dialogs come to mind, along with menus, comboxes and stylesheets.

It *is* possible to work around most of the problems but it takes a LOT of effort to make a Qt app look half-decent on Mac.

Zark says:

i have some apps actually ported to Qt Necessitas and I would love to test the actual version. Where can i found the links to download the source/binary win/linux what ever? I must be half retarded cause i am not able to find it

Eskil Abrahamsen Blomfeldt Eskil Abrahamsen Blomfeldt says:

You can find the Qt sources in either (the latter is a mirror, so it is not always up-to-date.)

Qt 5 for Android is available in the “dev” branch of the repositories.

TheTrueDigia says:

Couple of history lessons.
1- Finland the Kingdom of Sweden.
2- Finnish company exploits Sweden skilled work.
3- Profit?

sandsand says:

Great news! What about Bluetooth (BLE in particular) support?

Eskil Abrahamsen Blomfeldt Eskil Abrahamsen Blomfeldt says:

We have not started the work to look at bluetooth support yet.

help says:

Qt work with c++ or java?
Wich is beter?

Eskil Abrahamsen Blomfeldt Eskil Abrahamsen Blomfeldt says:

Qt is primarily a C++ framework.

elemental says:

Congratulations! Great work ^^

Jaime says:

I agree with Cyttorak and others on Ministro. If the user has to download Ministro in order for a Qt app to work, then Qt will not be an option for most commercial apps.

Benoit says:

Great news, congratulation for the port! Any plans or recommandations regarding QML components for android?

Jens says:

Yes there are plans, but they are targetting 5.2. We are doing a set of Qt Quick Controls primarily aimed at the desktop in 5.1 but we are also adding support for more touch based platforms after that. There are some preliminary API docs here:

And there is an experimental “touch” example which looks like this:

Ben Beckwith says:

Yahoo! Can’t wait to start playing with this.. 🙂

Strky says:

Approximately when are you going to release version 5.1?

phenom says:

i think Qt weak in GUI designing( controls and new components ).
this is simple form with Win Forms.
3d buttons or flat with large range of settings on it and so on ….

trusktr says:

You are completely wrong. Qt is much more powerful than Win Forms, but you have to be willing to learn how, and not just settle with the easy stuff where you don’t have to do any work, because then your work isn’t as original as it can be with Qt.

laedri says:

totally agreed with trusktr

trusktr says:

I haven’t tried PathAnimation yet, but does it support SVG? It’d be easy if a path could be supplied as an SVG. That way making paths is as easy as dragging the pen around in Inkscape then importing it to Qt.

Naishma says:

./configure -developer-build -xplatform android-g++ -android-ndk /Users/Naishma/Desktop/qt5-android/android-ndk-r8e -android-sdk /Users/Naishma/Desktop/qt5-android/replicant-sdk_linux-x86 -nomake tests -nomake examples


Can not detect the android host. Please use -android-ndk-host option to specify one
*** qtbase/configure exited with non-zero status.

Please help me :((

młóto says:

You really make it appear so easy along with your presentation however I find this matter to be really something that I believe I might never understand. It kind of feels too complex and extremely extensive for me. I am having a look forward to your subsequent post, I will try to get the dangle of it!

Strky says:

Will be a work qt with android support orace database?

Commenting closed.

Get started today with Qt Download now