sudo apt install openjdk-14-jdk
wget https://dl.google.com/android/repository/commandlinetools-linux-7302050_latest.zip
unzip commandlinetools-linux-6200805_latest.zip -d Android
mkdir Android/cmdline-tools/latest
mv Android/cmdline-tools/NOTICE.txt Android/cmdline-tools/latest
mv Android/cmdline-tools/bin Android/cmdline-tools/latest
mv Android/cmdline-tools/lib Android/cmdline-tools/latest
mv Android/cmdline-tools/source.properties Android/cmdline-tools/latest
export ANDROID_HOME=$HOME/Android
# Make sure emulator path comes before tools. Had trouble on Ubuntu with emulator from /tools being loaded
# instead of the one from /emulator
export PATH="$ANDROID_HOME/cmdline-tools/latest/bin:$PATH"
sdkmanager --sdk_root=${ANDROID_HOME}
sdkmanager --update
sdkmanager --list
sdkmanager "build-tools;30.0.3" "platform-tools" "platforms;android-30" "tools"
sdkmanager --licenses
sudo apt install gradle
if the commands is working here. You should set the exports to your .bash_profile, so you dont need to export everytime you open it (WSL).
echo "source ~/.bashrc" >> ~/.bash_profile
echo "export ANDROID_HOME=$HOME/Android" >> .bash_profile
echo 'export PATH="$ANDROID_HOME/cmdline-tools/latest/bin:$PATH"' >> .bash_profile
Note: you can get an updated Android SDK link from https://developer.android.com/studio/#downloads
We cannot mkdir Android/cmdline-tools/latest.
I got this error : mkdir: cannot create directory ‘Android/cmdline-tools/latest’: No such file or directory