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:
You may also need some 32-bit compatibility libraries for parts of the Android toolchain on some systems:
Option 1: install Android Studio
For interactive development, Android Studio is the easiest path because it includes the SDK manager UI:
Then follow the setup wizard. It downloads the SDK and platform tools for you.
After installation, it is common to export the SDK location:
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:
Then export the same key environment variables:
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:
If you want to run an emulator, install a system image too:
Then create an AVD:
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:
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_HOMEand add the SDK tool directories toPATH. - Use
sdkmanagerto 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.

