Building Android projects using Python

I’ve hated Ant since the first time I laid eyes on it. So I’m glad I finally took the time to understand the Android build process in detail, and sat down to reproduce it in Python.

A while ago, I wrote about how to build multiple versions of an Android app (like a free and a donate version). That was a long post. Compare it to this:

project = AndroidProject('AndroidManifest.xml', sdk_dir='/opt/android')
for version in (', ''):
    apk ="%s.apk" % version, package_name=version)
    apk.sign('keystore', 'alias', 'name')

Using the library, you can write your build scripts in plain Python, or with a Python-based build tool (personally, I’m using fabric). See for example the buildfile for Android-Autostarts.

The Github page has more usage samples.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s