How to build Python application for Android / iOS and Desktop

Welcome!!

This is a short post, and I’ll just present you Buildozer. With this tool, you will be able to build your Python projects to Android and iOS; and then deploy it easily to any platform.

If you prefer and if you are going to develop for Android with Python, you can just download the Kivy VM for Android.** Take a look in this post and see what do you need to use it.**

Currently, Buildozer supports packaging for:

  • Android: via Python for Android. You must have a Linux or OSX computer to be able to compile for Android.
  • iOS: via Kivy iOS. You must have an OSX computer to be able to compile for iOS.
  • Supporting others platform is in the roadmap (such as .exe for Windows, .dmg for OSX, etc.)

I - Install

i - Using PIP

If you have** PIP ** installed, just run the command bellow to install it:

pip install --upgrade buildozer

ii - Using easy_install

easy_install buildozer

iii - Building it from source

If you prefer, you can build Buildozer from source. Just run the following commands to try it:

	git clone git://github.com/kivy/buildozer
	cd buildozer
	python2.7 setup.py install

If you will be developing for Android, you will need at least Cython, few build libs and Java SDK. Some binaries of the Android SDK are still in 32 bits, so you need few 32 bits libraries available:

pip install --upgrade cython #use pip or other tool to install cython
apt-get install ccache lib32stdc++6 openjdk-7-jdk #if you are using Debian-like OS

Please, read more at Buildozer’s documentation

II - Using it

Buildozer is very well documented, so I’m not going to show you everything about it here, just read the documentation: https://github.com/kivy/buildozer#usage-example

You may want to read this doc too: http://buildozer.readthedocs.org/en/latest/quickstart.html

But to start a new project, go to the folder where the main.py is located and run:

buildozer init

This command will create the buildozer.spec. Open it and change the configurations.

To build and run it on Android, use the command:

buildozer android debug deploy run

To build and run in on iOS, use the command:

buildozer ios deploy run  

Or for desktop, just run it:

python main.py</blockquote>

Check available commands here: https://github.com/kivy/buildozer#usage

Now, you are able develop apps/games for any platform with Python!! Keep connected with the blog, I have a tutorial series about Mobile Development with Python(this is the part 0,” before you start”).

Thanks for reading, see you in the next post!!

Aron Bordin

Aron Bordin
Computer Science Student and AI researcher. Always coding something fun :)

[Tutorial] Developing Android Background Services

### Welcome!In this post, I'll show you how to develop background services on Android Studio. We'll see two type of services: `Service` a...… Continue reading