Skip to content

Instantly share code, notes, and snippets.

@ariefitriadin
Created August 28, 2024 02:35
Show Gist options
  • Save ariefitriadin/14921b33d7c13b64b19d3255584b7b94 to your computer and use it in GitHub Desktop.
Save ariefitriadin/14921b33d7c13b64b19d3255584b7b94 to your computer and use it in GitHub Desktop.
Install Android SDK in WSL 2
  1. update your WSL system:
sudo apt update && sudo apt upgrade -y
  1. Install Java Development Kit (JDK):
sudo apt install default-jdk
  1. Create a directory for the Android SDK:
mkdir -p ~/Android/Sdk
  1. Download the command line tools:
wget https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
  1. Unzip the downloaded file:
unzip commandlinetools-linux-9477386_latest.zip -d ~/Android/Sdk
  1. Set up environment variables. Edit your shell configuration file (e.g., ~/.bashrc or ~/.zshrc):
vim ~/.zshrc  OR vim ~/.bashrc

Add these lines at the end:

export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools
  1. Reload your shell configuration:
source ~/.bashrc
  1. Now use the SDK Manager to install necessary packages:
sdkmanager "platform-tools" "platforms;android-33" "build-tools;33.0.0"
  1. Accept licenses:
sdkmanager --licenses
  1. Verify the installation:
adb --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment