Standalone Toolchain for Android NDK in Docker

January 5, 2019 ยท View on GitHub

Or stand for short, is different versions of the Android NDK packaged in a container as a standalone toolchain.

The Android NDK is a bit of a beast sizewise, since it comes batteries included, bundling all architectures and a range of platforms for each release.

At the time of writing, the current release, r16, weighs in at 800M/2.9G zipped and unzipped respectively.

Typically you might only need a single platform version for a single architecture, so lugging all that extra stuff along is a bit excessive.

With a stand container, only a single specific toolchain for a platform and architecture is bundled, saving some much valued space and bandwidth.

Versioning

Each version is tagged according to the following naming convention:

rhardih/stand:<ndk>--<platform>--<toolchain>

The double dash is a bit of an eyesore, but since docker tags can only contain underscores, periods and dashes as special characters, and since toolchain names contain a mix of all three, this is a necessary evil.

E.g. to pull an arm container for platform android-21 from the r10e NDK:

docker pull rhardih/stand:r10e--android-21--arm-linux-androideabi-4.9

In the container, the toolchain is located at the root, e.g.:

/android-21-toolchain

Android platform api level

Code nameVersionAPI level
Pie9API level 28
Oreo8.1.0API level 27
Oreo8.0.0API level 26
Nougat7.1API level 25
Nougat7.0API level 24
Marshmallow6.0API level 23
Lollipop5.1API level 22
Lollipop5.0API level 21

E.g. android-21, is the platform to choose for building for Android 5.0.

The full list can be found here:

https://source.android.com/setup/start/build-numbers

By

In case a certain combination of NDK version, platform version and toolchain is not currently available on Docker Hub, you can use this small companion site, to trigger a new build:

standby.rhardih.io

It's a small Sinatra application deployed to Heroku. Source available at by.

Once you've triggered a build, go grab a cup of coffee and wait till Travis is done building and subsequently pushing the new image to Docker Hub.

Check the tags on https://hub.docker.com/r/rhardih/stand/tags after the build is done.

If all went well, the new image should be tagged and listed amongst the others.

Profit!

Disclaimer

Please note that the use the Android NDK is subject to the Terms and Conditions laid forth by Google. For the full text, please see:

https://developer.android.com/ndk/downloads/