-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Installing Android SDK Tools
The Android software development kit (SDK) is split across several packages: the Command-Line Tools (sdkmanager, avdmanager), Platform Tools (adb, sqlite3), Build Tools (aapt2, apksigner, d8 — the replacement for the legacy dx), Platforms (the API jars), and optional packages such as the emulator and NDK. See the official command-line tools overview for the full list, and ProGuard for shrinking/obfuscation.
The legacy tools/ package — which contained the android GUI/command and the tools/bin/sdkmanager script — was removed from updates and replaced by the Command-Line Tools package; the android command itself was retired in SDK Tools revision 25.3.0 (March 2017). The current sdkmanager lives at cmdline-tools/latest/bin/sdkmanager, and all of the manual install instructions below target that layout.
You can install the SDK through Android Studio, via Homebrew on macOS, or by downloading the Command-Line Tools archive manually.
Android Studio bundles the SDK and ships an in-IDE SDK Manager. Open Settings/Preferences > Languages & Frameworks > Android SDK and use the SDK Platforms and SDK Tools tabs to install the API levels and build tools your project needs. Make sure Android SDK Command-Line Tools (latest) is checked under SDK Tools so the sdkmanager binary is available on disk for CI and shell use.
On macOS, install the android-commandlinetools cask. The older android-sdk cask was discontinued upstream and has been disabled in Homebrew since late 2024.
- Install Homebrew — the package manager for macOS.
- Install a JDK if you don't have one (
sdkmanagerrequires Java):brew install --cask temurin
- Install the Command-Line Tools:
brew install --cask android-commandlinetools
The cask installs the SDK root at $HOMEBREW_PREFIX/share/android-commandlinetools (typically /opt/homebrew/share/android-commandlinetools on Apple Silicon, /usr/local/share/android-commandlinetools on Intel). Point ANDROID_HOME at that directory — see the Environment variables section below.
If you want to bring up an SDK without Android Studio or Homebrew (for example, on a build server), download the Command-Line Tools archive directly.
-
Open the Android Studio downloads page and scroll to Command line tools only. The archives are named
commandlinetools-<os>-<build>_latest.zip(for example,commandlinetools-linux-14742923_latest.zip). -
Create a directory to act as your SDK root (e.g.
~/android-sdk) and download the archive into it. -
Unzip the archive. The zip unpacks to a top-level
cmdline-tools/directory containingbin/,lib/,NOTICE.txt, andsource.properties. You must then re-arrange the contents into alatestsubdirectory so the final layout is exactly:~/android-sdk/ └── cmdline-tools/ └── latest/ ├── bin/ ├── lib/ ├── NOTICE.txt └── source.propertiesThe
latest/(or version-specific) subdirectory is required bysdkmanager; see the official install steps.
For example, on Linux:
mkdir -p ~/android-sdk/cmdline-tools
cd ~/android-sdk/cmdline-tools
wget https://dl.google.com/android/repository/commandlinetools-linux-14742923_latest.zip
unzip commandlinetools-linux-14742923_latest.zip
mv cmdline-tools latestCheck the downloads page for the current build number and SHA-256 before scripting this in CI.
Set ANDROID_HOME to your SDK root, and add the cmdline-tools/latest/bin and platform-tools directories to your PATH. The older ANDROID_SDK_ROOT variable is deprecated; Android Studio and the Android Gradle Plugin still honour it for backwards compatibility but will warn when both are set and disagree.
Edit your shell profile (~/.bash_profile, ~/.zshrc, etc.):
# Android
export ANDROID_HOME="$HOME/android-sdk"
export PATH="$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools"Reload the profile:
$ source ~/.bash_profileList installed and available packages:
sdkmanager --listInstall a typical baseline (use the API level and build-tools version your project declares for compileSdk / buildToolsVersion):
sdkmanager "platform-tools" "platforms;android-36" "build-tools;36.0.0"Update everything that is already installed:
sdkmanager --updateAccept the SDK licenses (the yes pipe is useful for non-interactive CI runs):
yes | sdkmanager --licensesSee the sdkmanager reference for the full command list, including --package_file, --channel, and --sdk_root flags.
On 64-bit Debian/Ubuntu hosts the emulator and a handful of native tools still expect 32-bit libraries to be present. Install them alongside a JDK that matches the Android Gradle Plugin's requirement (currently JDK 17 or newer):
sudo apt-get install libc6-dev-i386 lib32z1 openjdk-17-jdkAdjust the JDK package name for your distribution's repositories.
Created by CodePath with much help from the community. Contributed content licensed under cc-wiki with attribution required. You are free to remix and reuse, as long as you attribute and use a similar license.
Finding these guides helpful?
We need help from the broader community to improve these guides, add new topics and keep the topics up-to-date. See our contribution guidelines here and our topic issues list for great ways to help out.
Check these same guides through our standalone viewer for a better browsing experience and an improved search. Follow us on twitter @codepath for access to more useful Android development resources.