Squeezing Python into an Android with a Single APK
Join the DZone community and get the full member experience.Join For Free
Produced through the Kivy organization as a way to support their framework (also called Kivy), a cross-platform open source library, Python for Android is currently equipped with only one Java bootstrap for decompressing the files within the APK. Lighter bootstraps are currently in the works, but it could be some time before they reach consumers.
As it stands, Python for Android looks to be the most versatile tool yet for developing Python applications for the Android platform, with its biggest advantage being the self-contained binary files it creates that are so easy to install. Mathieu Virbel provides a list of pros and cons for working with Python for Android:
- A blacklist.txt file that can be used to exclude files in the final APK
- Reusable distribution for other applications
- Modular recipes architecture
-- Mathieu Virbel
- You need a main.py 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 going to work because the Android project is OpenGL ES 2.0: pyagme drawing will not work.
Another important factor to consider is that the code is currently being tested exclusively on Ubuntu 11.10 and only offers support for a few Python Modules including: pygame, kivy, android, sqlite3, and openssl. However, more testing and greater support should become available in the following months.
For more in-depth information, including coding and plenty of useful examples, be sure to visit Virbel's GitHub page.
Opinions expressed by DZone contributors are their own.