Buildozer Documentation: Release 0.11
Buildozer Documentation: Release 0.11
Release 0.11
Kivy’s Developers
1 Installation 3
1.1 Targeting Android . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Quickstart 5
2.1 Init and build for Android . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Run my application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Install on non-connected devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3 Specifications 7
3.1 Section [app] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4 Contribute 11
4.1 Write your own recipe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
i
ii
Buildozer Documentation, Release 0.11
Buildozer is a tool that aim to package mobiles application easily. It automates the entire build process, download the
prerequisites like python-for-android, Android SDK, NDK, etc.
Buildozer manage a file named buildozer.spec in your application directory, describing your application requirements
and settings such as title, icon, included modules etc. It will use the specification file to create a package for Android,
iOS, and more.
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.)
If you have any questions about Buildozer, please refer to the Kivy’s user mailing list.
Contents 1
Buildozer Documentation, Release 0.11
2 Contents
CHAPTER 1
Installation
Buildozer itself doesn’t depend on any library, and works on Python 2.7 and >= 3.3. Depending the platform you want
to target, you might need more tools installed. Buildozer tries to give you hints or tries to install few things for you,
but it doesn’t cover every situation.
First, install the buildozer project with:
pip install --upgrade buildozer
If you target Android, you must install at least Cython, few build libs, and a Java SDK. Some binaries of the Android
SDK are still in 32 bits, so you need few 32bits libraries available:
3
Buildozer Documentation, Release 0.11
4 Chapter 1. Installation
CHAPTER 2
Quickstart
1. Buildozer will try to guess the version of your application, by searching a line like __version__ = “1.0.3” in
your main.py. Ensure you have one at the start of your application. It is not mandatory but heavily advised.
2. Create a buildozer.spec file, with:
buildozer init
3. Edit the buildozer.spec according to the specifications. You should at least change the title, package.name and
package.domain in the [app] section.
4. Start a Android/debug build with:
5. Now it’s time for a coffee / tea, or a dinner if you have a slow computer. The first build will be slow, as it will
download the Android SDK, NDK, and others tools needed for the compilation. Don’t worry, thoses files will
be saved in a global directory and will be shared across the different project you’ll manage with Buildozer.
6. At the end, you should have an APK file in the bin/ directory.
Buildozer is able to deploy the application on your mobile, run it, and even get back the log into the console. It will
work only if you already compiled your application at least once:
5
Buildozer Documentation, Release 0.11
You can also set this line at the default command to do if Buildozer is started without any arguments:
To save the logcat output into a file named my_log.txt (the file will appear in your current directory):
If you have compiled a package, and want to share it easily with others devices, you might be interested with the serve
command. It will serve the bin/ directory over HTTP. Then you just have to access to the URL showed in the console
from your mobile:
buildozer serve
6 Chapter 2. Quickstart
CHAPTER 3
Specifications
This document explains in detail all the configuration tokens you can use in buildozer.spec.
7
Buildozer Documentation, Release 0.11
source.exclude_patterns = license,images/originals/*
__version__ = "1.0"
# version.regex =
# version.filename =
version = 1.0
requirements = kivy,requests
If your application tries to install a Python extension (ie, a Python package that requires compilation), and the
extension doesn’t have a recipe associated to Python-for-android, it will not work. We explicitly disable the
compilation here. If you want to make it work, contribute to the Python-for-android project by creating a recipe.
See Contribute.
• garden_requirements: List, Garden packages to include.
Add here the list of Kivy’s garden packages to include. For example:
garden_requirements = graph
Please note that if it doesn’t work, it might be because of the garden package itself. Refer to the author of the
package if he already tested it on your target platform, not us.
• presplash.filename: String, loading screen of your application.
Presplash is the image shown on the device during application loading. It is called presplash on Android,
and Loading image on iOS. The image might have different requirements depending the platform. Currently,
Buildozer works well only with Android, iOS support is not great on this.
8 Chapter 3. Specifications
Buildozer Documentation, Release 0.11
The image must be a JPG or PNG, preferable with Power-of-two size, e.g., a 512x512 image is perfect to target
all the devices. The image is not fitted, scaled, or anything on the device. If you provide a too-large image, it
might not fit on small screens.
• icon.filename: String, icon of your application.
The icon of your application. It must be a PNG of 512x512 size to be able to cover all the various platform
requirements.
• orientation: String, orientation of the application.
Indicate the orientation that your application supports. Defaults to landscape, but can be changed to portrait or
all.
• fullscreen: Boolean, fullscreen mode.
Defaults to true, your application will run in fullscreen. Means the status bar will be hidden. If you want to let
the user access the status bar, hour, notifications, use 0 as a value.
10 Chapter 3. Specifications
CHAPTER 4
Contribute
A recipe allows you to compile libraries / python extension for the mobile. Most of the time, the default compilation
instructions doesn’t work for the target, as ARM compiler / Android NDK introduce specificities that the library you
want doesn’t handle correctly, and you’ll need to patch. Also, because the Android platform cannot load more than 64
inline dynamic libraries, we have a mechanism to bundle all of them in one to ensure you’ll not hit this limitation.
To test your own recipe via Buildozer, you need to:
1. Fork Python for Android, and clone your own version (this will allow easy contribution later):
git clone http://github.com/YOURNAME/python-for-android
3. Push to Github
git push origin master
11
Buildozer Documentation, Release 0.11
4. Go to http://github.com/YOURNAME/python-for-android, and you should see your new branch and a button
“Pull Request” on it. Use it, write a description about what you did, and Send!
12 Chapter 4. Contribute
CHAPTER 5
• genindex
• modindex
• search
13