Wrapping up Cookiedozer


Buildozer is yet another great tool developed by the Kivy team. As I mentioned right in the beginning of Create Your Own Cookiecutter, Buildozer is still in alpha-development stage with limited OS support. However it is working just fine though on Ubuntu 14.04 (Trusty Tahr) 64-bit. If you are using Windows or MacOSX you may want to check out this guide on the Kivy Android Virtual Machine.


Back when I set it up Buildozer on Ubuntu Trusty Tahr I followed a guide by Aron Bordin. The official Buildozer Docs feature a similar chapter on the installation process for older Ubuntu versions, namely Precise Pangolin and Saucy Salamander.

Buildozer itself does not require anything beyond Python, which means you don’t need to install any of the 32bit libraries and not even Cython, in order to create a spec for your template.

Create a Spec File

Assumed you successfully installed Buildozer, you can now run the following command to create a spec file. It needs to be at the project root of your template next to its setup.py.

As a side note, if you are using GitHubs gitignore file for Python projects any *.spec files are excluded from version control. So I’ll quickly add the following line to Cookiedozers gitignore.

Next up I open buildozer.spec in a text editor and replace several values with Cookiecutter variables. You may want to have a brief look at the buildozer.spec of the famous game 2048 by Kivy core committer @tito as it is a great example of what you actually need to set to create a working Android apk.

For reasons of clarity and comprehensibility the following listings only contain the settings that are different from the defaults.

Once again I make use of Cookiecutters features to automatically transform the author’s name to all-lowercase separated by a dot which will be the package domain of our app. So ‘Raphael Pierzina’ ultimately becomes ‘raphael.pierzina’.

If you want to learn more about the advanced Cookiecutter techniques, go check out the docs at http://cookiecutter.readthedocs.org/en/latest/advanced_usage.html.

Build an Apk

By now we are able to create a deployable package of a rendered template.

You may want to give it a try. 😉

It is fairly easy with the tool at hand, however the first time you actually run the according Buildozer command it will download a bunch of tools including the Android SDK and NDK. In other words don’t worry if it takes quite a while as it’s just this one time for all your Buildozer projects. See Buildozer Quickstart.

Deploy to Your Mobile Device

The deployment process is just as easy once you enabled USB Debugging on your device.


It is very convenient to have the commands that you use frequently in a simple Makefile. Let’s get right into it.

We are still at the root of our app, so we can just create a new file.

It depends on your personal preferences what you want to put in the Makefile. As for my part I constantly run the test suite and occasionally I forget the syntax to create a html coverage report 🙂 So it makes sense to incorporate the according commands.

I’m using xsd-open to view the generated html files in Firefox, in case your wondering. Other than that I implemented a help command and put it right in the beginning of the file. Invoking make without any arguments runs the first target, namely help.

We covered pretty much all of the other commands over the course of this tutorial, so you should be comfortable setting up your own Makefile.

Alright, that should do 🙂

We created a fully-fledged Cookiecutter template for a Kivy app that features a pytest suite, sphinx docs and a Makefile. You can easily deploy the app to your favourite Android mobile device via Buildozer. Last but not least the application is an installable Python Package, with entry points set up, which you can even upload to PyPI.

As always you can find the latest version of the Cookiedozer template at https://github.com/hackebrot/cookiedozer

Hope you liked this tutorial! Feel free to ping me in case of any queries.