Qt for Android (Necessitas Framework) - Does it Really Work?

    This post participates in the contest "Smart Phones for Smart Posts . "

    It so happened that I have some experience developing applications for Qt, and recently there was a communicator on Android. Having learned that there is a Necessitas project (formerly called Android-Lighthouse), I wanted to test the possibility of launching Qt applications for Android in practice.





    To start porting the program, you need to install the Necessitas SDK (there are versions for Linux, Windows, MacOS). It includes Qt Creator, various Qt components, its own libraries, and also installs the Android SDK and NDK if they are not already on the computer.

    In the settings window (Tools-> Options) Necessitas Qt Creator there is an additional tab - Android. The project properties also look different; there appear options specific to Android, such as permissions to use phone resources. It is also necessary to clearly indicate which libraries the application uses (in my case, it was QtCore, QtGUI, QtDeclarative). If you do not specify the desired library or specify a name for the application, the output will be a broken .apk.

    For testing on a real device, you also need to dig deeper with adb. This is probably familiar to everyone who develops something for Android under Linux, but for those who come from the Qt world, this may be unexpected. In order for the device to be available for application deployment (and Qt Creator does not crash when it cannot find such a device), you need to makeUSB settings and restart adb under root:

    cd / opt / necessitas / android-sdk-linux_x86 / platform-tools /
    ./adb kill-server
    sudo ./adb start-server

    You can only build Qt applications under Android 2.2 and higher selecting an older version will result in an error during compilation. If errors occur during assembly, it is worth deleting all .pro.user files from the project folder, leaving only one .pro file, and reopen the project in Qt Creator.

    Otherwise, the Necessitas SDK is perfectly done - it is configured in 5 minutes, and the output is ready to install .apk.

         

    When the program is launched on the device for the first time, it downloads the Ministro application from the Android Market. It acts as a bridge between the Qt application and the operating system, loading the libraries necessary for a particular Qt application. At the first start, libraries are downloaded from the Web, then simply loaded into memory.

    Having figured out how all this works, I managed to successfully compile and run the OppiaSanoja program for learning foreign words on the ZTE Blade communicator that was reflashed on Froyo. Necessitas correctly supports the basic functionality it needs - rendering QML (with respect to the proportions and appearance of the elements - everything looks exactly like on Maemo and MeeGo), working with the file system, accessing QSettings (however, all settings are reset when the program is reinstalled, which doesn't happen, say, on Maemo).



    It’s quite possible for the developer and other interested parties to use the product - there are no critical flaws and limitations in Necessitas (although for more complex programs it may be missing, for example, hardware rendering of OpenGL). And it’s just the sight itself that fascinates you - the look of a working Qt application on an Android device. But it’s too early to move such works to the masses. Here are some errors found even in a simple program:

    - When the application is idle and restarted, an error window is displayed. This problem is typical for Android, since on the Nokia N900 the same application hangs in the background for weeks and is correctly restored back.

    - When restoring from the background, the current QML view is not drawn (the user will see a black screen until he begins to poke around the screen or slide). This problem has already been noticed by developers ; in some future version it will be fixed.

    - The virtual keyboard always remains on the screen, being called up at least once (of course, the user can remove it by pressing the back button, but it would be better if the program itself could do this).

    - And finally, despite the clear task of only landscape orientation, Ministro works on the sensor and puts the program in portrait mode if the user rotates the device.



    Perhaps some of these issues can be resolved one way or another, but Necessitas does not have extensive documentation, and they ignored these questions on the mailing list (as, however, most of the others are ignored).

    Summing up, we can say that now Necessitas is more of a beautiful toy for geeks (by the way, there is a version for launching Qt-applications on Bada) than a framework actually applicable in the development (it is also impossible to create massive applications at the project page )

    Given the situation in Nokia and the small number of Necessitas developers, it is unlikely that in the near future it will be possible to create Qt-applications for Android for release to the masses. However, you can always join the project (Necessitas works on the principle of open source) and work on improving the Qt + Android bundle.

    Also popular now: