Setting up Android SDK on a DigitalOcean Ubuntu droplet

Standard

Setting up a remote build environment for an Android project wasn’t something i thought I’d need to do but as it turned out today, I did need it and after consulting some pages online, it wasn’t so difficult to achieve. I’m documenting this to make my future attempts easier to accomplish and also to help anyone out there with the required information.

The recommended way to install the Android SDK (at the time of this writing) is by installing Android Studio but as I’m using a DigitalOcean droplet, there’s no GUI for me to interact with the installer. Fortunately for us, the official Android Studio download page also has a link (at the bottom of the page) to download just the command-line tools for Android.

Scroll down to the bottom of the page and copy the download link for Linux. Next, from your ssh terminal, create the  /home/android-sdk  directory. From within that directory, do execute:

Replace the url with the one you copied from the downloads page so you have the latest version. Once this is done, unzip the zip archive so that you have the following directory structure:

Setup environment variables:

Next, display a list of available packages by running:

This would show you the list of packages that you can install from a host of different sources. The sdkmanager documentation shows how to use the tool.

To install the platforms and build-tools needed, just run:

And that’s all.

Your Android SDK is setup successfully.