- update your WSL system:
sudo apt update && sudo apt upgrade -y
- Install Java Development Kit (JDK):
sudo apt install default-jdk
- Create a directory for the Android SDK:
mkdir -p ~/Android/Sdk
- Download the command line tools:
wget https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
- Unzip the downloaded file:
unzip commandlinetools-linux-9477386_latest.zip -d ~/Android/Sdk
- 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
- Reload your shell configuration:
source ~/.bashrc
- Now use the SDK Manager to install necessary packages:
sdkmanager "platform-tools" "platforms;android-33" "build-tools;33.0.0"
- Accept licenses:
sdkmanager --licenses
- Verify the installation:
adb --version