Installing Android SDK in Docker

For a recent project, I had to include the Android SDK build tools as part of a Jenkins Dockerfile. No problem. Download and execute installer, right?

Wrong. With Google installers come license agreements, and I needed a way to reliably accept the terms and conditions of the installer and it’s dependencies automatically. Here’s what my Dockerfile looks like:

Not complicated, really, but worth documenting for others out there.

Backwards-compatibility for Build Tools in Jenkins

I have ‘build-tools-24.0.1’ in there because the app I’m working with has not been upgraded to the latest version of Gradle, but it’s worth noting too because not everyone has the luxury of changing code/compile settings just because Google ships new binaries. Thanks Google, you really know how to break my build. ;*

Instead, I chose to own the responsibility of the version of tools needed on my build nodes for the types of projects I intend to compile on them. Because of this, I need to know the specific android update sdk filter codes that correspond to the pretty package names I see on my workstation in SDK Manager.

To list the codes that you might need in your own update filter, use the following command under your Android SDK tools folder:

…which displays a list like this:

That is all.

Semi-related Reading: