Install Android SDK in the Ubuntu 20.04 LTS — Without Android Studio

André B. Silva
2 min readMay 26, 2020

--

To obtain the Android SDK, Android Studio is required by default. However, Android Studio sizes 772 MB and still download of the others needed tools.

For those that want to have only Visual Studio Code as mobile development IDE, they can get just the Android Command Tools.

1. Download Android Command Tools:

Visual Studio Code is highly recommended to use with Android Command Tools.

1.1 Check for the correct “commandlinetools***” file download:

ls -l ~/Downloads

2. Create a Development Tools directory in your home directory, called DevTools (or use an appropriate name):

sudo mkdir ~/DevTools

TIP: Use that directory to install any others development tools, software development kits et all.

3. Create a sub-directory, into DevTools, called Android:

It’s necessary to locate all ANDROID SDK subdirectories.

sudo mkdir ~/DevTools/Android

2.1 Create another sub-directory, into Android, called cmdline-tools:

sudo mkdir ~/DevTools/Android/cmdline-tools

3. Extract the “commandlinetools-linux-***.zip” file into a specific directory: cmdline-tools:

unzip commandlinetools-linux-6200805_latest.zip

3.1 Move tools directory into the cmdline-tools directory:

mv tools ~/DevTools/Android/cmdline-tools/

Next to it will be the other sub-directories of the Android SDK. Since commandlinetools is just an Android tool, as well as the others that will be on the side.

3.2 Check for the tools was moved successful:

ls -l ~/DevTools/Android/cmdline-tools/tools

5. Set the path of Android SDK directory in the Ubuntu environment variables. Edit the following file:

sudo nano ~/.bashrc

5.1 Add to the end of the .bashrc file:

DEV_TOOLS="/home/$USER/DevTools"
JAVA_HOME="$DEV_TOOLS/JDK/jdk-11.0.7+10"
ANDROID_HOME="$DEV_TOOLS/Android"
export JAVA_HOME
export ANDROID_HOME
PATH="$JAVA_HOME/bin:$ANDROID_HOME/cmdline-tools/tools/bin:$ANDROID_HOME/platform-tools:$PATH"

TIP: To install and set up JDK (required), read this story.

5.2 Reset PATH:

source ~/.bashrc

6. Testing sdkmanager:

sdkmanager --version

7. Listing all packages available:

sdkmanager --list

8. Install Platform for Android 29:

sdkmanager "platform-tools" "platforms;android-29"

9. Install Build Tools for Android 29:

sdkmanager "build-tools" "build-tools;29.0.3"

10. Accept Android Licenses:

sdkmanager --licenses

11. Update Android Packages when necessary:

sdkmanager --update

It worked for me. I use Ubuntu Mate 20.04.

I hope that works for you too.

Thank you!

--

--