Android SDK
Ubuntu
Installation Guide
Linux Development
Software Development Kit

How to install Android SDK on Ubuntu?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

On Ubuntu, the usual way to get the Android SDK is either through Android Studio or through the standalone command-line tools. Android Studio is the easier choice for normal development. The command-line tools are useful for CI, servers, or minimal headless setups.

Install the prerequisites

Before installing the SDK, make sure the machine has Java and a few common utilities:

bash
sudo apt update
sudo apt install openjdk-17-jdk unzip wget -y
java -version

You may also need some 32-bit compatibility libraries for parts of the Android toolchain on some systems:

bash
sudo apt install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 -y

Option 1: install Android Studio

For interactive development, Android Studio is the easiest path because it includes the SDK manager UI:

bash
wget https://redirector.gvt1.com/edgedl/android/studio/ide-zips/current/android-studio-*-linux.tar.gz
sudo tar -xzf android-studio-*-linux.tar.gz -C /opt/
/opt/android-studio/bin/studio.sh

Then follow the setup wizard. It downloads the SDK and platform tools for you.

After installation, it is common to export the SDK location:

bash
1export ANDROID_HOME=$HOME/Android/Sdk
2export PATH=$PATH:$ANDROID_HOME/platform-tools
3export PATH=$PATH:$ANDROID_HOME/emulator
4export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin

Add those lines to ~/.bashrc or ~/.zshrc if you want them available in future shells.

Option 2: install command-line tools only

For headless environments, install the command-line SDK tools directly:

bash
1mkdir -p $HOME/android-sdk/cmdline-tools
2cd $HOME/android-sdk
3
4wget https://dl.google.com/android/repository/commandlinetools-linux-latest.zip
5unzip commandlinetools-linux-latest.zip -d cmdline-tools
6mv cmdline-tools/cmdline-tools cmdline-tools/latest

Then export the same key environment variables:

bash
export ANDROID_HOME=$HOME/android-sdk
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

Now you can use sdkmanager.

Install the actual SDK packages

The command-line tools alone are not enough. You still need platform tools, build tools, and usually at least one Android platform:

bash
yes | sdkmanager --licenses
sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0"

If you want to run an emulator, install a system image too:

bash
sdkmanager "emulator" "system-images;android-34;google_apis;x86_64"

Then create an AVD:

bash
avdmanager create avd -n test_device -k "system-images;android-34;google_apis;x86_64"
emulator -avd test_device

Pick one SDK location and keep it consistent

One practical detail that saves time later is choosing a single SDK directory and sticking to it. Android Studio defaults to $HOME/Android/Sdk, while many command-line setups use something like $HOME/android-sdk. Either is fine, but mixing both paths on the same machine creates confusing build failures when Gradle, adb, and Android Studio point at different SDK installations.

If you already have Android Studio installed, it is usually simpler to reuse its SDK path and expose that directory through your shell configuration.

Verify the installation

A quick health check is:

bash
adb version
sdkmanager --list_installed
echo $ANDROID_HOME

If those work and the SDK path looks correct, the core installation is in place.

Common Pitfalls

The biggest mistake is unpacking the command-line tools into the wrong folder layout. sdkmanager expects the tools under cmdline-tools/latest, not just any arbitrary extraction directory.

Another mistake is forgetting to set ANDROID_HOME or update PATH. The SDK may be installed correctly while shell commands still fail because the environment variables are missing.

Developers also skip sdkmanager --licenses and then get blocked later during builds by unaccepted license prompts.

Finally, do not assume the SDK alone is enough for development. You usually need platform tools, build tools, and at least one platform package before Gradle builds work correctly.

Summary

  • On Ubuntu, install the Android SDK through Android Studio or the standalone command-line tools.
  • Set ANDROID_HOME and add the SDK tool directories to PATH.
  • Use sdkmanager to install platform tools, build tools, and Android platforms.
  • Accept licenses with sdkmanager --licenses.
  • The most common setup problems are wrong directory layout and missing environment variables.

Course illustration
Course illustration

All Rights Reserved.