Skip to content

Commit

Permalink
chore: Update install_android_sdk script to download Android SDK fr…
Browse files Browse the repository at this point in the history
…om a specified URL
  • Loading branch information
bartekpacia committed Aug 26, 2024
1 parent 38b9552 commit c1bcbb3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/create_avd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env sh
set -euo pipefail

ANDROID_USER_HOME="${ANDROID_USER_HOME:-$HOME/.android}"
DEVICE="${1:-}"
Expand Down Expand Up @@ -34,7 +35,6 @@ avd_name="${uppercase_device}_API_$API_LEVEL"
echo "Will create AVD: $avd_name"

avdmanager create avd \
--sdcard '8192M' \
--package "system-images;android-$API_LEVEL;google_apis;arm64-v8a" \
--name "$avd_name" \
--device "$DEVICE"
Expand Down
21 changes: 21 additions & 0 deletions bin/install_android_sdk
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env sh
set -euo pipefail

ANDROID_HOME="${ANDROID_HOME:-$HOME/androidsdk}"
ANDROID_USER_HOME="${ANDROID_USER_HOME:-$HOME/.android}"
URL="${1:-}"

if [ -z "$URL" ]; then
echo "URL is required. Get it from here: https://stackoverflow.com/a/78890086/7009800"
exit 1
fi

curl -fsSL \
--output-dir ~ \
--output android-clt.zip \
"$URL"

cd ~
unzip android-clt.zip
mkdir -p "$ANDROID_HOME/cmdline-tools/latest"
mv ~/cmdline-tools/* "$ANDROID_HOME/cmdline-tools/latest"

0 comments on commit c1bcbb3

Please sign in to comment.