Skip to content

Instantly share code, notes, and snippets.

@yuvipanda
Created April 10, 2014 18:13
Show Gist options
  • Save yuvipanda/10408391 to your computer and use it in GitHub Desktop.
Save yuvipanda/10408391 to your computer and use it in GitHub Desktop.
Setup android sdk automatically
SDK_HOME_PATH="$HOME"
SDK_PATH="$SDK_HOME_PATH/android-sdk-linux"
# Needs to be updated when new releases are made
SDK_DOWNLOAD_URL="http://dl.google.com/android/android-sdk_r22.6.2-linux.tgz"
curl --location $SDK_DOWNLOAD_URL | tar -xz -C $SDK_HOME_PATH
# Just install platform-tools, build-tools & Android-19
expect -c "
set timeout -1;
spawn $SDK_PATH/tools/android update sdk -u --filter 1,2,4
expect {
\"Do you accept the license\" { exp_send \"y\r\"; exp_continue }
eof
}
"
@berndsi
Copy link

berndsi commented Jul 25, 2014

Instead of using the positional id filters (which depends on what you have installed already and can change over time) it would be better to use filter names, which is more stable.
You can get the list of names with android list sdk -e -a

@berndsi
Copy link

berndsi commented Jul 25, 2014

android update sdk -u --filter "platform-tools,build-tools-19.1.0,android-19"

@berndsi
Copy link

berndsi commented Jul 29, 2014

@hodonsky
Copy link

hodonsky commented Jun 2, 2015

Hey thanks for the expect script, saved me from doing dirty and horrible things like echo "y" | android update sdk -a -u ....

@petersg83
Copy link

I used your solution relicmelex ! For me it seems to be the prettiest <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment