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 ('com.foo.app.free, 'com.foo.app.donate'): apk = project.build("%s.apk" % version, package_name=version) apk.sign('keystore', 'alias', 'name') apk.align()
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.