Skip to content

Instantly share code, notes, and snippets.

@haridas
Last active November 24, 2016 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haridas/ad8a49da352488cc8f0f65268a782071 to your computer and use it in GitHub Desktop.
Save haridas/ad8a49da352488cc8f0f65268a782071 to your computer and use it in GitHub Desktop.
Manage Android sdk from command line

Some times it would be very handy to check / update android sdk from command line. For automation pipelines it surely helps. Here is few commands that can be used to check or update android sdk from command line.

List Installed SDK details

haridas@haridas-HP-ProBook-4440s:~$ android list sdk
Refresh Sources:
  Fetching https://dl.google.com/android/repository/addons_list-2.xml
  Validate XML
  Parse XML
  Fetched Add-ons List successfully
  Refresh Sources
  Fetching URL: https://dl.google.com/android/repository/repository-11.xml
  Validate XML: https://dl.google.com/android/repository/repository-11.xml
  Parse XML:    https://dl.google.com/android/repository/repository-11.xml
  Fetching URL: https://dl.google.com/android/repository/addon.xml
  Validate XML: https://dl.google.com/android/repository/addon.xml
  Parse XML:    https://dl.google.com/android/repository/addon.xml
  Fetching URL: https://dl.google.com/android/repository/glass/addon.xml
  Validate XML: https://dl.google.com/android/repository/glass/addon.xml
  Parse XML:    https://dl.google.com/android/repository/glass/addon.xml
  Fetching URL: https://dl.google.com/android/repository/extras/intel/addon.xml
  Validate XML: https://dl.google.com/android/repository/extras/intel/addon.xml
  Parse XML:    https://dl.google.com/android/repository/extras/intel/addon.xml
  Fetching URL: https://dl.google.com/android/repository/sys-img/android/sys-img.xml
  Validate XML: https://dl.google.com/android/repository/sys-img/android/sys-img.xml
  Parse XML:    https://dl.google.com/android/repository/sys-img/android/sys-img.xml
  Fetching URL: https://dl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Validate XML: https://dl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Parse XML:    https://dl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Fetching URL: https://dl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Validate XML: https://dl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Parse XML:    https://dl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Fetching URL: https://dl.google.com/android/repository/sys-img/google_apis/sys-img.xml
  Validate XML: https://dl.google.com/android/repository/sys-img/google_apis/sys-img.xml
  Parse XML:    https://dl.google.com/android/repository/sys-img/google_apis/sys-img.xml
Packages available for installation or update: 15
   1- Android SDK Tools, revision 25.2.3
   2- Android SDK Platform-tools, revision 25.0.1
   3- Documentation for Android SDK, API 24, revision 1
   4- SDK Platform Android 7.1.1, API 25, revision 2
   5- Google APIs Intel x86 Atom_64 System Image, Android API 23, revision 18
   6- Google APIs, Android API 24, revision 1
   7- Android Support Repository, revision 40
   8- Android Auto Desktop Head Unit emulator, revision 1.1
   9- Google Play services, revision 38
  10- Google Repository, revision 39
  11- Google Play APK Expansion library, revision 1
  12- Google Play Licensing Library, revision 1
  13- Google Play Billing Library, revision 5
  14- Android Auto API Simulators, revision 1
  15- Google Web Driver, revision 2

List available / new SDK details

Android SDK includes multiple packages like SDK platform-tools, SDK tools, build-tools, System images for emulator, and extra addon packages or extra packages provided by google ( playstore libraries ).

To know what all are packaes are available for installation use bellow command -

# List all available packages indexed with number.
$ android update list sdk -a

# list with index plus a label associated with each package.
$ android update list sdk -a -e

eg:

----------
id: 171 or **"extra-google-google_play_services"**
     Type: Extra
     Desc: Google Play services, revision 38
           By Google Inc.
           Google Play services Javadocs and sample code
           Install path: extras/google/google_play_services
----------

Install selected SDK packages

$ android update sdk --no-ui --all --filter tools,platform-tools,build-tools-24.0.3,android-23,sys-img-x86-android-24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment