#!/bin/bash
# Notes:
# - To list all possible packages, run `android list sdk -all --extended`
# - If install operation fails, it may be because selected module is obsolete
# - Enable --dry-mode on `android update sdk` to show what will be installed while actually doing nothing
# - `tools` and `platform-tools` install the newest package available
# - Build Tools - build-tool-xx.x.x selects a specific version to install
# - SDK Platforms - android-{API_Level} installs the SDK Platform for XX API Level ex. android-23 or android-19
# - System Images - sys-img-{architecture}-{platform}-android-{API_Level} ex. sys-img-x86_64-android-23 or sys-img-armeabi-v7a-android-23
# - System Images w/ Google APIs- sys-img-{architecture}-addon-google_apis-google-{API_Level} ex. sys-img-armeabi-v7a-addon-google_apis-google-23
# - Addons = addon-google_apis-google-{API_Level} ex. addon-google_apis-google-23
# - There is almost no point to installing ARM v7a system images, they cannot be accellerated by HAXM
PACKAGES=(
tools
platform-tools
build-tools-23.0.2
android-23
#addon-google_apis-google-23
#sys-img-x86_64-addon-google_apis-google-23
extra-android-m2repository
extra-android-support
extra-google-m2repository
extra-google-google_play_services
extra-intel-Hardware_Accelerated_Execution_Manager
)
# Array join with ','
FILTERS=$( IFS=, ; echo "${PACKAGES[*]}" )
# hack to repeat 'y' while `android update sdk` is running
( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) | android update sdk --no-ui --all --filter ${FILTERS}