How to install Android SDK Build Tools on the command line? How to install Android SDK Build Tools on the command line? android android

How to install Android SDK Build Tools on the command line?


By default, the SDK Manager from the command line does not include the build tools in the list. They're in the "obsolete" category. To see all available downloads, use

android list sdk --all

And then to get one of the packages in that list from the command line, use:

android update sdk -u -a -t <package no.>

Where -u stands for --no-ui, -a stands for --all and -t stands for --filter.

If you need to install multiple packages do:

android update sdk -u -a -t 1,2,3,4,..,n 

Where 1,2,..,n is the package number listed with the list command above


As mentioned in other answers, you can use the --filter option to limit the installed packages:

android update sdk --filter ...

The other answers don't mention that you can use constant string identifiers instead of indexes (which will change) for the filter options. This is helpful for unattended or scripted installs. Man for --filter option:

... This also accepts the identifiers returned by 'list sdk --extended'.

android list sdk --all --extended :

Packages available for installation or update: 97----------id: 1 or "tools"     Type: Tool     Desc: Android SDK Tools, revision 22.6.2----------id: 2 or "platform-tools"     Type: PlatformTool     Desc: Android SDK Platform-tools, revision 19.0.1----------id: 3 or "build-tools-19.0.3"     Type: BuildTool     Desc: Android SDK Build-tools, revision 19.0.3

Then you can use the string ids as the filter options to precisely specify the versions you want:

android update sdk --filter tools,platform-tools,build-tools-19.0.3 etc


Version 25.2.3 (and higher) of Android SDK Tools package contains new tool - sdkmanager - which simplifies this task of installing build-tools from the command line.
It is located in android_sdk/tools/bin folder.

Usage (from documentation):

sdkmanager packages [options]

The packages argument is an SDK-style path, wrapped in quotes (for example, "build-tools;25.0.0" or "platforms;android-25"). You can pass multiple package paths, separated with a space, but they must each be wrapped in their own set of quotes.

Example usage (on my Mac):

alex@mbpro:~/sdk/tools/bin$ ls ../../build-tools/  25.0.0/   alex@mbpro:~/sdk/tools/bin$ ./sdkmanager "build-tools;25.0.2"  done   alex@mbpro:~/sdk/tools/bin$ ls ../../build-tools/  25.0.0/ 25.0.2/

You can also specify various options, for example to force all connections to use HTTP (--no_https), or in order to use proxy server (--proxy_host=address and --proxy_port=port).

To check the available options, use the --help flag. On my machine (Mac), the output is as following:

alex@mbpro:~/sdk/tools/bin$ ./sdkmanager --helpUsage:   sdkmanager [--uninstall] [<common args>] \    [--package_file <package-file>] [<packages>...]  sdkmanager --update [<common args>]  sdkmanager --list [<common args>]In its first form, installs, or uninstalls, or updates packages.    <package> is a sdk-style path (e.g. "build-tools;23.0.0" or              "platforms;android-23").    <package-file> is a text file where each line is a sdk-style path                   of a package to install or uninstall.    Multiple --package_file arguments may be specified in combination     with explicit paths.In its second form (with --update), currently installed packages are    updated to the latest version.In its third form, all installed and available packages are printed out.Common Arguments:    --sdk_root=<sdkRootPath>: Use the specified SDK root instead of the SDK containing this tool    --channel=<channelId>: Include packages in channels up to <channelId>.                           Common channels are:                           0 (Stable), 1 (Beta), 2 (Dev), and 3 (Canary).    --include_obsolete: With --list, show obsolete packages in the                        package listing. With --update, update obsolete                        packages as well as non-obsolete.    --no_https: Force all connections to use http rather than https.    --proxy=<http | socks>: Connect via a proxy of the given type.    --proxy_host=<IP or DNS address>: IP or DNS address of the proxy to use.    --proxy_port=<port #>: Proxy port to connect to.* If the env var REPO_OS_OVERRIDE is set to "windows",  "macosx", or "linux", packages will be downloaded for that OS.