[PyQt] Development for Android
phil at riverbankcomputing.com
Fri Jul 24 12:06:31 BST 2015
On 24/07/2015 11:24 am, Rembrand at daxLAB wrote:
> Dear all,
> Please share your thoughts with me on how to get even a simple PyQt
> app running on Android.
> __Some background info__:
> I use Fedora 20 (KDE) to develop my PyQt apps
> I develop using Python 2.7x in combination with PyQt4
> Already have a desktop app for Windows and Linux variants (based on
> same Python 2.7 and PyQt4).
> Want to port the desktop app to Android (for mobile/tablet platforms)
> __Issues I found out__:
> Qt4 is not supported at Android (I cannot find pre compiled binaries
> for Qt4 except from the Necessitas project which is in Beta since
> 2012, hardly any devellopment there).
> I have to switch to Qt5, right?
> Q1) Am I correct that I then have to switch to Python 3.x too?
No, but I don't use Python2 on a day to day basis so it naturally gets
> Q2) I assume that PyQtDeploy does not contain the precompiled Qt5
> binaries for Android either, is that correct?
> Q3) Are there any precompiled binaries for Qt5 I can download for
The Qt Company provides them for commercial customers. I don't know
about anything else.
> Q4) If there are no binaries to download for Android, I have to cross
> compile them, where can I find a solid piece of documentation to do
> Q5) Do I cross compile just for Android AND/OR do I have to specify
> the target hardware platform during that cross compile (seems to me
> that there are more mobile processors/architectures or is there just
> one used by most known vendors like Samsung, LG, HTC, Google)?
armv7 seems to be standard.
> Q6) Once I would have cross compiled Qt5, I assume I can then use
> PyQtDeploy to mold all things together in which I myself have to
> select all Qt5 binaries and other binaries needed by my app, is that
pyqtdeploy creates a compilable C++ program from your Python
application. Whether that is a self contained executable or relies on
external shared libraries is up to you. How the program (and any
dependencies) is packaged for a particular platform is up to you. For
Android and iOS Qt includes additional tools (used after pyqtdeploy)
that will do this for you.
> Q7) Since I write closed source, I do not want to expose my source.
> Can PyQtDeploy hide the source in the final result?
The Python source code is embedded in the executable as compressed
bytecode. It can never be truly hidden, but that's adequate for most
If you are using the LGPL version of Qt then you also need to consider
the obligations that it imposes, ie. allow people to replace the Qt
shared libraries that you distribute.
> Q8) Is the final result of PyQtDeploy an APK or do I have to make the
> APK myself after using PyQtDeploy?
You make it using androiddeployqt which is part of Qt.
More information about the PyQt