Wednesday, May 13, 2015

Installing Android SDK using Command Line

To Download Android SDK


From the Android web site, download the stand-alone version of the Android SDK for your operating system, and decompress the archive.

https://developer.android.com/sdk/index.html


Android Robot

* The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. [CC BY 3.0], via Wikimedia Commons


Setup PATH


Set up your PATH to include the SDK tools.

For example, when you use Linux and extract the SDK to /home/jenkins/android-sdk-linux, you can add the following in ~/.profile (or ~/.bash_profile).

export ANDROID_HOME=/home/jenkins/android-sdk-linux
export PATH=$PATH:${ANDROID_HOME}/platforms:${ANDROID_HOME}/tools


Install All Available platforms (Not Recommended)


You can use the command, "android update sdk --no-ui" to install most of all available platforms (except for obsolete packages) all at once, but this installs too many packages and takes much time.

$ android update sdk --no-ui

I rather recommend installing just the packages you need.


List All the Available Packages


To list all the packages available with an index number:

$ android list sdk --all


Install One of the Packages


If you want to install one of the packages in the list:

$ android update sdk --no-ui --all --filter <Package No.>


Install Multiple Packages


You can install multiple packages with comma delimited package number list, like:

$ android update sdk --no-ui --all --filter 1,2,3,...,n


Need Help?


Use "--help" to see the available options.

$ android --help list sdk

       Usage:
       android [global options] list sdk [action options]
       Global options:
  -h --help       : Help on a specific command.
  -v --verbose    : Verbose mode, shows errors, warnings and all messages.
     --clear-cache: Clear the SDK Manager repository manifest cache.
  -s --silent     : Silent mode, shows errors only.

                   Action "list sdk":
  Lists remote SDK repository.
Options:
  -o --obsolete  : Deprecated. Please use --all instead.
  -a --all       : Lists all available packages (including obsolete and
                   installed ones)
     --proxy-host: HTTP/HTTPS proxy host (overrides settings if defined)
     --proxy-port: HTTP/HTTPS proxy port (overrides settings if defined)
  -s --no-https  : Uses HTTP instead of HTTPS (the default) for downloads.
  -e --extended  : Displays extended details on each package
  -u --no-ui     : Displays list result on console (no GUI) [Default: true]

$ android --help update sdk

       Usage:
       android [global options] update sdk [action options]
       Global options:
  -h --help       : Help on a specific command.
  -v --verbose    : Verbose mode, shows errors, warnings and all messages.
     --clear-cache: Clear the SDK Manager repository manifest cache.
  -s --silent     : Silent mode, shows errors only.

                     Action "update sdk":
  Updates the SDK by suggesting new platforms to install if available.
Options:
     --proxy-port: HTTP/HTTPS proxy port (overrides settings if defined)
     --proxy-host: HTTP/HTTPS proxy host (overrides settings if defined)
  -s --no-https  : Uses HTTP instead of HTTPS (the default) for downloads.
  -a --all       : Includes all packages (such as obsolete and non-dependent
                   ones.)
  -f --force     : Forces replacement of a package or its parts, even if
                   something has been modified.
  -u --no-ui     : Updates from command-line (does not display the GUI)
  -p --obsolete  : Deprecated. Please use --all instead.
  -t --filter    : A filter that limits the update to the specified types of
                   packages in the form of a comma-separated list of
                   [platform, system-image, tool, platform-tool, doc, sample,
                   source]. This also accepts the identifiers returned by
                   'list sdk --extended'.
  -n --dry-mode  : Simulates the update but does not download or install
                   anything.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.