Jenkins로 안드로이드 프로젝트를 자동으로 빌드하는 시스템을 구축하다보면 UI 없이 Console에서 Android SDK를 업데이트해야 하는 상황이 발생합니다.
먼저 SDK 루트 디렉토리에서 tools 디렉토리로 이동합니다.
cd tools
설치할 수 있는 SDK 목록을 확인합니다.
$ ./android list sdk
Refresh Sources:
Fetching https://dl-ssl.google.com/android/repository/addons_list-2.xml
Validate XML
Parse XML
Fetched Add-ons List successfully
Refresh Sources
Fetching URL: https://dl-ssl.google.com/android/repository/repository-10.xml
Validate XML: https://dl-ssl.google.com/android/repository/repository-10.xml
Parse XML: https://dl-ssl.google.com/android/repository/repository-10.xml
Fetching URL: https://dl-ssl.google.com/android/repository/addon.xml
Validate XML: https://dl-ssl.google.com/android/repository/addon.xml
Parse XML: https://dl-ssl.google.com/android/repository/addon.xml
Fetching URL: https://dl-ssl.google.com/android/repository/addon-6.xml
Validate XML: https://dl-ssl.google.com/android/repository/addon-6.xml
Parse XML: https://dl-ssl.google.com/android/repository/addon-6.xml
Fetching URL: https://dl-ssl.google.com/glass/gdk/addon.xml
Validate XML: https://dl-ssl.google.com/glass/gdk/addon.xml
Parse XML: https://dl-ssl.google.com/glass/gdk/addon.xml
Fetching URL: https://dl-ssl.google.com/android/repository/extras/intel/addon.xml
Validate XML: https://dl-ssl.google.com/android/repository/extras/intel/addon.xml
Parse XML: https://dl-ssl.google.com/android/repository/extras/intel/addon.xml
Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
Parse XML: https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
Parse XML: https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
Parse XML: https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
Validate XML: https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
Parse XML: https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
Packages available for installation or update: 15
1- Android SDK Tools, revision 23.0.2
2- Documentation for Android 'L' Preview SDK, revision 1
3- SDK Platform Android 4.4W, API 20, revision 1
4- SDK Platform Android L Preview, revision 1
5- Samples for SDK API 20, revision 1
6- Samples for SDK API L Preview, revision 1
7- Google APIs (x86 System Image), Android API 19, revision 6
8- Google APIs (ARM System Image), Android API 19, revision 6
9- Glass Development Kit Preview, Android API 19, revision 8
10- Android Support Repository, revision 6
11- Android Support Library, revision 20
12- Google Play services, revision 18
13- Google Repository, revision 9
14- Google Play Billing Library, revision 5
15- Google Play Licensing Library, revision 2
아래와 같은 커맨드로 원하는 항목만 선택적으로 업데이트 할 수 있습니다.
$ ./android update sdk --no-ui --filter 1,10,11,12
의존성 문제 때문인지 원하는 항목이 한 번에 나타나지 않을 수도 있습니다. 보통은 리스트를 확인하고 업데이트를 요청하는 과정을 반복하게 되더군요.