Skip to content

Instantly share code, notes, and snippets.

@oliverspryn
Last active June 14, 2024 15:09
Show Gist options
  • Save oliverspryn/e4f4fc055def312274c2cf2d14278817 to your computer and use it in GitHub Desktop.
Save oliverspryn/e4f4fc055def312274c2cf2d14278817 to your computer and use it in GitHub Desktop.
Download and extract the Android Command Line tools
#!/bin/bash
# Example Definitions, for Mac Setups
destination="$HOME/android/"
toolsDownloadUrl=$(curl https://developer.android.com/studio | grep -o "https:\/\/dl.google.com\/android\/repository\/commandlinetools\-mac\-[0-9]*_latest\.zip")
# Download and extract the contents
curl --location -o android.zip $toolsDownloadUrl
unzip -q android.zip -d ./android-temp
mkdir -p "$destination/cmdline-tools/latest"
mv ./android-temp/tools/* "$destination/cmdline-tools/latest"
rm -rf ./android-temp
rm android.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment