Version 11 (modified by Martin Kolman, 12 years ago) (diff)


Porting modRana to Android

As there is currently no GTK port for Android and not even any project trying to do this, only the QML GUI is relevant for running modRana on Android.

Most of this is based on THP's excellent ''PySide for Android'' work.



Python is needed as modRana is written in Python. The Python 2.6 binaries provided by THP can be used. This archive also contains PySide binaries.

To be usable, the a /data/python folder needs to be created on the Android folder, and the bin and lib folders need to be copied inside it (this can be easily done with the adb push command when the device is connected & in debugging mode).

Then according to the THP, the main Python binary needs to be made executable:

$ su
# chmod 755 /data/python/bin/python

Qt + QML

The Necessitas project provides Qt libriries with QML support. Due to Android lacking proper package management, there is an android application called Ministro that handles library installation requests from Necessitas using applications. When an application using Necessitas is started for the first time, it redirects the user to the Google Play store to install Ministro (or Ministro II). Once Ministro is installed and its service is running, the application calls this service to request the Qt Libraries it needs.

It seems that content of this request is governed by the libs.xml file in the Necessitas application package - if some libs are missing, this fil needs to be modified.

There are two Ministro versions:

  • Ministro - provides Alpha 2 (0.2) libraries
  • Ministro II - provides Alpha 3 libraries (cca 0.34)

The ALpha 2 Qt libraries provided by necessitas are suable, but have a few issues, for example:

  • text both in Qt widgets and QML is rendered as rectangles unleess it is set to italic

This is more of a technical overview as from the point of view of the Python application, all this (making sure Ministro is installed & requesting Qt Libraries) is handled by the PySide Launcher and the application does'n need to be even aware of it.


To work, PySide binaries need to be compatible with the installed Python & Qt versions.

Compiled PySide binaries are part of the Python tarball provided by THP.

PySide Launcher

PySide programs can't be currently launched from the shell and have to use a special launcher application that makes sure all needed libraires are avalable and provides the application with acces to the screen.

There is a PySide Launcher APK on THPs site, but it doesn't work with QtDeclarative due to missing dependency on libQtOpenGL.

As a result, the PySide launcher source needs to be slightly modified and a new APK created.

Modified Pyside Launcher

Software prerequisites:

  • ant
  • Necessitas Qt SDK
Modifying the PySide Launcher project

get the source from Gtihub:

git clone

Then in in: pyside-launcher-android/android/res/values/libs.xml

The qt_libs section should look like this:

    <array name="qt_libs">

This file is used to request Qt libraries from Ministro - if you need more libraries, add them there. Don't forget to omit the lib prefix.

List of libraries available from Ministro (Alpha 2):

Rebuilding the APK

First, change in pyside-launcher/android/ path to the sdk.dir to poin to the Android SDK inside the Necessitas SDK, for example:


Then run ant like this inside the android folder

cd pyside-launcher/android
and debug

(adb complains about the package created by ant release due to missing certificates, but likes the package created by ant debug just fine)

If ant complains about outdated project, update the project using the android tool, which is normally available in the tools directory in the Android-sdk.

android update project -p pyside-launcher/android/

Qt Components

There is an Android port of Qt Components.

Qt Components Theme

Qt Components need a theme to work correctly. Without a theme, not only would most elements be transparent but also the layout is quite broken.

There are multiple sources for a working theme:

  • taking it from the Qt SDK
  • from an N9 filesystem
  • from the Fremantle Qt Components theme package
  • from Nemo

Updated Prerequisites

While the above mentioned combination works, it could be improved by using more up to date software packages.


As modRana and Mieru run just fine with Python 2.5, Python version is really not a limiting factor. Any Python version that compiles on Android and is compatible with other prerequisites will do.

Qt + QML

The currently used Necessitas Qt version (0.2 -> Alpha 2) is outdated and causes quite a few issues - most being, that all text is rendered as rectangles, unless it is set to be itallic.

As a result, it should be a priority to start using the Necessitas Alpha 3 (0.34+-) as soon as possible.

To do this, the following is needed:

  • a Python distribution compiled for Android
  • compiling PySide against this Python version & the Necessitas Qt
  • an updated PySide Launcher that uses Ministro II (which provides the Alpha 3 libraries)


At least version 1.0.5 should be used, as this is the version that is running Fremantle CSSU, without any issues. Some older version on vanilla PR 1.3 Fremantle is known to cause issues, namely with multiple decorators for a single method.

Qt Components


error: insufficient permissions for device

First do:

adb stop-server

Then as root do:

adb start-server