FEB
27
2011

Bogdan Vatra

Bogdan Vatra

  Name: Bogdan Daniel Vatra
  Age: 31
  Location: Braşov, Romania
  Project: Qt on Android


We had heard something about it but few people took it seriously. Yet last week we were surprised by a very nice announcement: the Qt SDK has been ported to Android and the first release is available. We were immediately interested in knowing more.

This time, in the Behind KDE Platforms series, Pau Garcia i Quiles talks about Qt on Android with Bogdan Vatra, the lead developer behind it.

Introductory questions

Hello Bogdan, glad to talk to you. Please, tell us a bit about yourself

Hello everybody. I'm Bogdan Daniel Vatra, I'm almost 31 years old, I'm working and living in Braşov, Romania with my lovely wife and my wonderful little boy.

How and when did you get started with Qt on Android

On June 2009 I was hired by Route 66 as a Linux developer.

Shortly after that we began to port our engine to the Android platform, whose SDK requires developers to use Java. But we didn't use Java for our engine! Our product engine is in C/C++, so we had to do a lot of "dirty" hacks: we cloned the whole Android operating system, compiled it, took the toolchain, created our own "Native Development Kit" and began to port the engine. In a surprisingly short time and also very easily we managed to have our engine running on Android. This happened before Google released the first Native Development Kit, which allows C++ to be used for Android development.

I fell in love with Android immediately, but hmmm... something was wrong with it... it seemed like something was missing, something very important, it was the Qt framework, my favourite framework! So, when I had time, in December 2009 I gave it a try. After about one month I was seeing the first images generated by Qt on Android Emulator. It felt fantastic!

How old is the Qt on Android project? Who started it?

I started to port Qt to Android at the end of 2009. When I started it the name was android-lighthouse but I had to change the name name to "Necessitas" just before the SDK release because Nokia and Google didn't allow me to use Qt and/or Android words.

Lighthouse, a research project started by Nokia, helped me a lot. This project made my life very easy, the changes I had to make were only a small set of changes into the Qt tree. The "biggest change" was to add another shared memory implementation based on ashmem.

Corporations are tough protecting their brands :-) I'm curious, what does "Necessitas" mean?

"Necessitas" is a Latin word, the Roman goddess of necessity. It literally means "necessity". The word also has some more profound and powerful meanings.

Development

What do you do these days in Qt Android?

A lot :)

Currently I'm focused on finishing the Ministro package installer/provider, finishing the Qt Creator integration with the Qt framework and trying to find solutions for some big issues (like OpenGL support).

Anyone who wants to help can check our missing tasks list.

By the way, "Ministro" is also a latin word, and it has a nice meaning: "to attend, to serve".

Are you being paid for that work or do you use your spare time?

My work is the result of pure passion and love for free software. I'm very happy that I did it this way, because I wasn't forced by anybody to do anything I didn't want to.

How many hours have you dedicated to Qt and Qt SDK on Android development?

I don't know exactly, I think no more than 200-300.

How many hours do you usually spend doing FLOSS development weekly?

Depends, about 5-10.

Users

Say I am a Qt or Android developer and I want to develop an application. What do I do first?

It's very easy, you have to download the SDK, install it and enjoy. It's like developing a normal Qt application.

Currently the SDK is installable only on GNU/Linux platforms.

Are there plans to port the SDK to Windows, Mac and/or any other platform?

Someone contacted me about a port to Windows, he wants to give it a try.

Personally I don't have enough time for this, but I'll be very happy to accept other people's contributions.

What versions of Qt, Qt Creator, etc are currently supported?

This SDK is based on the forthcoming Qt 4.8.0, Qt Creator 2.2 and Qt Mobility 1.2.

Wow, you are up to the latest developments. How long after the official releases of Qt 4.8.0, Qt Creator 2.2 and Qt Mobility 1.2 do you think it will take to have Qt SDK for Android? 1 day? 1 week? 1 month?

Probably 1-2 weeks.

How different is Android from what the average Qt C++ developer is used to?

Actually there is, or the should be, no difference. At least that is what I tried to accomplish.

The first time, you need to setup Qt Creator. After that, it should not be any more complicated to create Android applications than to create desktop applications.

There are some additional steps to do but they are well supported in Qt Creator.

So the Qt SDK for Android using QMake, right?

Yes, to compile the C++ part.

What languages does this release of the Qt SDK support?

For now, C++ only.

Are there plans to port Qt Jambi to Android?

I don't have any plans.

Maybe this has changed after the release announcement? (I've seen lots of articles about Necessitas! Congratulations!)

We'll see ... Thanks for congrats.

Feature

How complete is the port of Qt to Android? Are there any parts missing?

There are some missing parts like OpenGL, menu integration, style, etc. We hope with this release, more people will join us and will help to finish it.

Namely:

  • OpenGL is the most tricky part now, Qt needs a new OpenGL surface for every top level widget (a drop down list box, a menu, etc.), the problem is on Android platform, using official APIs I can't control the Z-order of these surfaces (SurfaceView), so I need to find another way to do it. Somebody contacted me and they want to work together on this problem. I hope we will soon find a solution.
  • Style plugin. This is the next big thing. For now, all Qt apps look very odd in Android, so we must create a style plugin, which would take all the styling information from the Android system and apply them to Qt applications. This is a medium-complexity task (neither easy, neither hard) but the visual impact will be fantastic.
  • Menus. This task is medium-hard. To complete this task we must perform some changes into Qt. I'll come with more details when we have an API for it.

As always, you can consult our TODO list

Does this release of the Qt SDK include the Qt Mobility APIs?

Not yet. Unfortunately I didn't have enough time to include it, but I hope in the next release it will be there thanks to other contributors.

When do you plan to make the next release?

2-3 weeks from now.

What about Phonon and Qt Multimedia?

As I said before, contributors are doing a great job!

Qt on desktop supports several graphics systems, each of them with its own advantages and disadvantages. On Android, the 2D graphics system is based on Google’s own Skia library. What graphics systems does Qt Android support?

Android Platform Plugin is using Qt’s raster engine (which is pretty good).

For now there are no plans to move to Skia. I don't really expect a big performance boost, as in my opinion Qt’s raster engine is one of the best in the world.

Are 2D and 3D graphics accelerated when using Qt on Android?

No, not yet. When we'll find a solution for OpenGL everything will be accelerated via OpenGL.

Why is OpenGL a problem? Does the Android NDK not provide access to it?

They provide access to OpenGL but as I said before there are some (major) limitations.

Do you support QML on Android?

Yes, we do!

How is the Qt SDK for Android better than the official Java SDK and/or C++ NDKs?

This SDK is focused in bringing Qt on Android. It depends and uses the official Android SDK and NDK.

Thanks to the Qt Creator integration creating, managing, compiling, deploying and debugging Qt applications is a walk in the park.

Also, I'm planning to add support for non-Qt application for Android platform. They will have to use the QMake build system and, most probably, a small part of Java code.

Do you have plans to add CMake support?

Well, that one is complicated.

Qt Creator's CMake support is not the best in town and it will be very difficult.

That being said, I'm using CMake for other projects but I'm using it with KDevelop. By the way, kudos to KDevelop developers, I love their work.

I hope someone from Nokia will resurrect the plans to move away from QMake.

About the IDE, how is Qt Creator better than Eclipse?

While Eclipse has no Qt support for Android, Qt Creator (Necessitas version) comes with first class support for Qt on Android.

You have everything you need to create, manage, deploy, and debug Qt applications on Android platforms.

I really believe Qt Creator is a better choice for Qt on Android, because it has better C/C++ support. I also think the debugging experience is (will) be better. For instance, using Qt Creator you can debug from the first line of code.

Does the Qt SDK for Android support the Android emulator?

Of course, it supports any Android emulator/device.

Does the SDK install it? Or do you need to perform configuration manually?

Qt SDK for Android installs only the Qt framework and Qt Creator, it does not install the Android SDK and NDK. We provide instructions to install the SDK and Qt Creator).

Are there preconfigured "profiles" for development for popular phones? (say, the Google Nexus One, Samsung Galaxy S, HTC Desire, etc)

No, not at this moment.

Can you debug and run applications on an Android device from QtCreator?

Yes, you can!

Great! How hard was it to get debugging working on Android?

The debugging support uses gdbserver, with a special part in Java, which ensures you'll be able to debug from the first C++ line of code. This section is well integrated with Qt Creator (Qt Creator passes some special parameters to the application, informing it that Qt Creator expects your application to run in debugging mode), and it does all the magic: starts gdbserver and attaches it to the current process identifier, then your application's execution stops and waits patiently for Qt Creator to connects to gdbserver.

Let’s talk about the build system: what build system should we use when developing applications? Qt's own QMake? Apache Ant?

Actually, both of them.

The Qt SDK uses QMake for your C++ part and Ant for the Java part. By using Qt Creator, the latter will be transparent to the user.

Do you mean Qt SDK for Android combines a part in C++ which uses QMake and a part in Java which uses Ant?

Yes. Every Android application which uses native code (C/C++) contains two parts.

The first part is the C/C++ application. For this half, Necessitas uses QMake to compile it.

The second part is the Java one. For this half, Necessitas uses Ant to compile it and create the package. Since Android 2.3, you can create native-only applications but you still need Ant to create the package.

Integration

How well does Qt SDK for Android support different resolutions, screen sizes, mobile phones (3'' and 4'') and tablets (7'' and 10'')

Qt supports any screen resolutions and sizes. Your application should be careful what and where to use.

Do you mean there is nothing special for Android in this regard?

Yes. How cool is that?

Are sensors (gyroscope, accelerometer, etc) and Android services (contacts, calendar, mail, etc) supported?

All this will be accessible via the Qt Mobility APIs. Let's hope Qt Mobility will be part of the next SDK release.

What input systems can Qt applications for Android use?

Keyboard, gestures and multitouch are supported.

I think someone was working on voice support.

Is it possible to develop Android widgets using Qt?

Not at this moment. Let's hope it's just a "not yet" :-)

Can you combine Qt and Android code? Is it difficult?

Yes, you can combine Qt and Android code. It is not too difficult but I don't recommend it. I would prefer people to focus on the Qt Mobility port!

Is this documented somewhere?

Only on the qt-android mail list. We will try to create a FAQ section on sf.net project page.

When you try to install an application on Android, you are told about the permissions you are going to give that application on your device, such as access to the Internet, contacts, SMSs, make calls, etc. How good is this integration?

Yes, you need to set application permissions. You'll find Qt Creator very useful for this job

Applications and market

Qt on Android has been announced only a few days ago. Do you know any Qt application that has already been ported to Android?

In principle any Qt application (except OpenGL apps) can be ported to Android.

If this application uses only the Qt framework (except Qt OpenGL and Qt Multimedia) it should just work.

You don't have to do anything special, but as I said before I don't recommend people to deploy apps on Andrid Market yet, they should be patient until the APIs will be stable.

Recently people have tried to put Qt-based applications for Macintosh through the Apple Mac Store and they found a few issues which are being addressed, or have been using workarounds. Do you see any problem for Qt-based applications to be accepted on the Android Marked? How much heavier are they (download-wise) than applications using the official SDKs?

First and foremost, Google is not Apple. Apple has become a very evil and selfish company (even worse than Micro$oft). Google is completely different and I think people trying to compare this two companies are insulting Google.

Actually the main reason to start and continue this port was that Google made a great free operating system.

I haven't had any problems deploying Qt apps on Android Market. I deployed a Qt demo application (animatedtiles) to test Ministro. It was a piece of cake, it was a pleasure!

Contributors

How many developers are working on Qt and Qt SDK Android?

The Qt framework, Qt Creator and Ministro (sadly) were made 99% only by me, even though I hate to work alone. These three components are now part of the SDK which I released last week.

The documentation on sf.net was written by Damien Buhl. He also helped me a lot with answering people's questions. Thank you very much, Damien! I'm very happy to work with you!

Elektobit team started a few months ago with the Qt Mobility port. Now I'm waiting for them to modify their work according to the Necessitas license policy. After that I'll be very happy to include their contributions into the Qt SDK for Android.

And of course, I would like more developers to join us.

I’m sure many of our readers want to contribute and are now thinking in becoming developers. Could you please give some directions for them?

We are using the Qt contribution model. Follow the link and you'll find all the information you need to become a contributor.

Basically a developer needs to:

  1. go to the official Qt on Android repository
  2. create a personal clone on gitorious
  3. peek on task and let us know
  4. complete that task
  5. create a merge request

Future

At the last FOSDEM, IcedRobot, an initiative to bring the Android API onto the Linux desktop (without Dalvik VM) was announced? Have you tried Qt SDK with it?

No.

KDE developers put a lot of effort in porting KDE to Maemo and Meego. Are there plans to port KDE, etc to Android?

I don't know, KDE is my default (and by far my favourite) desktop environment. It will be nice to see KDE applications on my phone.

What do you think about the Nokia-Microsoft strategic partnership?

I still can't believe that Nokia have given away Navteq, which in my humble opinion is the most precious asset Nokia have, to Microsoft. For what? For Bing and the worst mobile operating system out there?

I still can't believe that they have chosen Microsoft instead of Intel and Windows Phone instead of MeeGo.

Are you worried about the future of Qt?

No, I'm not. I think Qt is safe thanks to (L)GPL license.

In your opinion, what are the biggest challenges Qt on Android faces?

For now, it's the OpenGL support.

Collaboration

Qt was originally a desktop-centric library and Qtopia on the side. In 2008, Nokia acquired Trolltech and we saw a burst of development on the mobile front, with official ports to Symbian, Maemo and Meego and unofficial ports to iPhone, webOS, Android, Kindle, etc. Is there any collaboration between people making unofficial ports to mobile platforms? How different are the problems each platform faces?

As far as I know, there is no sharing of information, probably because those platforms are completely different.

Yet I guess most of the problems the ports to those platforms are almost the same and maybe a qt-lighthouse mailing list where people talked about the missing features, problems, etc could be useful?

Yes, a qt-lighthouse mailing would be a useful place, but not a qt-android (or qt-you-name-it) mailing list.

I found the Lighthouse API very easy and intuitive so probably you will not need too much extra information.

Thiago Macieira, Qt's Product Manager, recently said in the qt-interest mailing list Nokia wants to work with you and integrate Qt Android in mainline Qt for 4.8. Can you tell us something more about this?

I was very surprised by Thiago's statement, and I really hope we'll work together to finish this project. I promise, I will do my best to see Qt on Android platform.

Personal life

It is no secret that spouses of open source software developers generally consider we spend too much time in front of the computer in our hobby. What does your wife think of your involvement with Qt Android?

She understands and supports me and I'm very grateful for that.

Actually, I didn't spend too much time on this port, I spent some time but hopefully not too much! ;-)

Are you involved in other open source projects?

Yes, I'm also the author of the eXaro project and some other small projects.

Apart from Qt, what other hobbies do you have?

Music, movies, gym, everything which makes me feel good.

Where do you see yourself (and family), Qt and Qt on Android in 5 years?

Good question, I like to live the present and not to think that far :)

Thanks

Is there anything you want to add?

I want to send a big thank you to the Elektobit team for their priceless contribution to QtMobility, and to the Necessitas documentation team.

Pau wants to thank his co-worker Mario del Pozo for his valuable contribution while preparing the questions for Bogdan, and Jonathan Riddell for the proofreading.