Android headless SDK installation

I wanted to install Android SDK without installing this ugly IDE. The main goal was to rebuild existing projects, so I didn't need something as heavy. The main difficulty came when I downloaded the actual sdk, and receive the following message from Google.

Because you've downloaded the command line tools (not Android Studio), there are no install instructions.

First things first. The SDK can be easily found on the download page of the Android developer website. Hidden at the end of the page in a section named Get just the command line tools.

We download a .zip file, because it's to complicated to provide a tarball, and unzip it somewhere, preferably ~/.android.

Then we update your ~/.profile, or wherever we put your env to include the following lines mutatis mutandis and reload our session.

export ANDROID_HOME="$HOME/.android"
export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$PATH"

Once we're here, the installation is straightforward once we now which command to run.

android update sdk

Then we must install some build tools.

sdkmanager "platforms;android-23"
sdkmanager "build-tools;23.0.1"

And also we must not forget to install all those compat libraries.

sdkmanager "extras;android;m2repository"

And voilà!