Introducing “Python for Android”

I’m glad to share a new project called Python for Android. The goal of this project is to package your python application into an APK.

The project is under the umbrella of Kivy organization, but is not designed to be limited to Kivy only. Read the documentation to correctly install the NDK/SDK Android, and set the needed environment variables.

The packaging is done in 4 steps:
1. Ensure you have Android SDK/NDK downloaded and correctly installed
2. Ensure you have some environment set
3. Create a Python distribution containing the selected modules
4. Use that distribution to build an APK of your Python application

Creating the python distribution is as simple as that:

# create a simple distribution with python + PIL + Kivy
./ -m "pil kivy"

# create a distribution with python + openssl + pil + kivy
./ -m "openssl pil kivy"

A directory dist/default will be created, including the result of the whole arm compilation.
Available libraries as for today: jpeg pil png sdl sqlite3 pygame kivy android libxml2 libxslt lxml ffmpeg openssl.

The second step is a little bit harder, since you need to provide more information for Android:

cd dist/default
./ --package org.test.touchtracer --name touchtracer \
--version 1.0 --dir ~/code/kivy/examples/demo/touchtracer debug installd

# --package: java name of your application
# --name: title of your application
# --version: version of your application
# --dir: location of your application containing the

Then you’ll get a nicely bin/touchtracer-1.0-debug.apk


  • A blacklist.txt file that can be used to exclude files in the final APK
  • Reusable distribution for other applications
  • Modular recipes architecture
  • Be able to build independents python distributions


  • You need a file that will be used for starting your application
  • Only one java bootstrap available, using OpenGL ES 2.0.
  • Only Kivy toolkit is working. I’m sure that other people can enhance it to add other toolkit recipes. But for example, pygame is not gonna to work because the android project is OpenGL ES 2.0: pygame drawing will not work.

I hope you’ll like it :)

We would like to thank Renpy / PGS4A for its initial pygame for android project

Kivy on Android, part 2

Hi guys,

Look like people are following my blog and waiting for android version of Kivy.
We have a launcher that you can already use. Check the :

Maybe during the next release, or a little bit after, i’ll release a software to create an Android package of a Kivy application. The code is already on launchpad, but it’s still a work in progress. As soon as i have finished, i’ll publish it on kivy-dev mailing list. If you didn’t subscribe yet, do it now ! :)

More to come by the end of that week… !

Kivy (next PyMT) on Android, step 1 done !

Tonight is a wonderful night.

I know that i didn't announce Kivy officially yet, but i'll do it in another blog post very soon. You just need to know that Kivy is the next PyMT version. From 2 years ago with thomas, we have regulary doubts and reflections about using Python for PyMT. And i've started to look more at the future, and i was deeply convince that for our sake, we must be able to run on a Webbrowser. The goal is simple: same code for every platform, at least what we use every day: Linux / Windows / Macosx / Android / iOS.

Android and iOS are new OS, and we was thinking that except running in webbrowser, we will be never able to run on it. And we have started to target a futur with fewer dependencies, OpenGL ES 2.0 compatible, and so on. This vision have been named Kivy. Theses last days, i've removed numpy and pyopengl dependencies. Pygame is the only library required for running an application with widgets. (minimal don't mean full featured).

And i've started to look at the android platform, since Tom from Renpy library have deliver a pygame subset for android. He just made an awesome work. My part was just to understand how it work, and get Kivy compilation done.

For now, here is what i've got :

Ok, but what i got exactly ?

  • Python/Pygame running from renpytom project
  • Failed attempt to use numpy on android
  • Kivy adapation for android (opengl debug mode, removing numpy and pyopengl, link on opengl es 2.0...)
  • Pygame change to create OpenGL ES 2.0
  • Various patch on the build system

And here is my step 2 :

  • Send to upstream all the patch on the build system
  • Resolve symbol conflict when 2 compiled module have the same name (kivy.event and pygame.event... nice naming.)
  • Add a way of detecting Android platform from python
  • Add multitouch support to pygame and/or kivy
  • Add android sleep/wakeup in kivy
  • Write documentation about how to compile a kivy application on android

For now, sleep time ! Enjoy.