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

Zhenguo Yang picture Zhenguo Yang · Jul 31, 2013 · Viewed 304.9k times · Source

I want to setup the Android dev environment from command line, and encounter the following issue:

wget http://dl.google.com/android/android-sdk_r22.0.5-linux.tgz

after extract the file, run

tools/android update sdk --no-ui

However, it is too slow on running

Fetching https://dl-ssl.google.com/android/repository/addons_list-2.xml

The result is that nothing in folder build-tools, and I want is aapt and apkbuilder, since I want to build apk from command line without ant.

Answer

nsg picture nsg · Oct 17, 2013

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