wiki:PyOtherSideForAndroid

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

--

PyOtherSide for Android

This article describes current progress towards being able to run applications using Python 3 & QtQuick 2.0 using the PyOtherSide Python <-> QtQuick bindings.

Current Status

  • Qt 5 & QtQuick 2.0 - available & working
  • Python 3 (3.2) - available & working
  • PyOtherSide - WiP
    • compilation - working
    • basic deployment - working
    • using PyOtherSide without crashing - not yet working
  • standalone APK package - doable, not yet working

PyOtherSide

Setting up

This are the version of software versions I have used for my experiments, it is possible other versions might also work, but this is what I have worked with.

Get PyOtherSide 1.3 source code

wget https://thp.io/2011/pyotherside/pyotherside-1.3.0.tar.gz

Get & install the Qt 5.3 Android SDK

Basically just follow the guide on the Qt wiki to get the Qt 5 Android SDK & it's dependencies installed.

Configure an Android device to be accessible by ADB I've tested the resulting software on my HP TouchPad? running Cyanogenmod Android 4.0, accessible with ADB. So this 'guide/howto' expect that you also have an Android device accessible over ADB. The Android emulator might also work, but I haven't tried that.

Compiling for Android

Preparing the PyOtherSide? project

Unpack the PyOtherSide tarball and enter the resulting directory:

tar -xvf pyotherside-1.3.0.tar.gz
cd pyotherside-1.3.0

Next you need a Python 3 compiled for Android, so you can build PyOtherSide against it. I have found such Python 3 distribution on the Python 2.6 for Android project website and used it drop in library bundle for compiling PyOtherSide.

So download the lib bundle tarball to the Pyotherside folder and unpack it here:

wget http://www.modrana.org/platforms/android/pyotherside/guide/python3_android_libs_bundle.tar.gz
tar xvf python3_android_libs_bundle.tar.gz

When you are done, there should be a libs folder in your pyotherside-1.3.0 folder.

In the next step we need to tell the project to use the Android compiled libraries instead of the system ones, so edit the src/src.pro file and replace the line reading:

INCLUDEPATH += .

With this:

INCLUDEPATH += $$PWD/../libs/python32/build_dependencies/ .
LIBS += -L$$PWD/../libs/python32 -lpython3.2 -ldl

Then in tests/tests.pro replace:

INCLUDEPATH += . ../src

With:

INCLUDEPATH += $$PWD/../libs/python32/build_dependencies/ . ../src
LIBS += -L$$PWD/../libs/python32 -lpython3.2

This tells the project to use our locally available Python 3 compiled for Android instead of the system-wide Python 3 when building PyOtherSide.

Building the PyOtherSide project in QtCreator

Now the PyOtherSide project should be ready to be opened in QtCreator (make sure you are running the one corresponding to the Qt 5.3 Android SDK you have downloaded and installed previously). So start the right QtCreator and open the pyotherside-1.3.0/pyotherside.pro file.

Basic deployment

Running a "hello world" program