首先, 你得有个VPN

参考以下三篇完成Android SDK的安装

https://www.digitalocean.com/community/tutorials/how-to-build-android-apps-with-jenkins

http://stackoverflow.com/questions/4681697/is-there-a-way-to-automate-the-android-sdk-installation

http://developer.android.com/sdk/installing/adding-packages.html

首先到 https://developer.android.com/sdk/index.html 下载SDK Tools Only, 我下的是 android-sdk_r24.1.2-linux.tgz

在linux里解压缩, 用于下载组件的是tools/android. 参数说明

 
   
  1. Action "update sdk":
  2. Updates the SDK by suggesting new platforms to install if available.
  3. Options:
  4. -f --force Forces replacement of a package or its parts, even if something has been modified
  5. -u --no-ui Updates from command-line (does not display the GUI)
  6. -o --obsolete Installs obsolete packages
  7. -t --filter A filter that limits the update to the specified types of packages in the form of
  8. a comma-separated list of [platform, tool, platform-tool, doc, sample, extra]
  9. -s --no-https Uses HTTP instead of HTTPS (the default) for downloads
  10. -n --dry-mode Simulates the update but does not download or install anything

查看可用的组件

 
   
  1. android list sdk --all

会得到一个类似以下的列表, 把要下载的序号记下来

 
   
  1. - Android SDK Tools, revision
  2. - Android SDK Platform-tools, revision
  3. - Android SDK Build-tools, revision
  4. - Android SDK Build-tools, revision (Obsolete)
  5. - Android SDK Build-tools, revision
  6. - Android SDK Build-tools, revision (Obsolete)
  7. - Android SDK Build-tools, revision 21.1 (Obsolete)
  8. - Android SDK Build-tools, revision (Obsolete)
  9. - Android SDK Build-tools, revision (Obsolete)
  10. - Android SDK Build-tools, revision (Obsolete)
  11. - Android SDK Build-tools, revision
  12. - Android SDK Build-tools, revision 19.1
  13. - Android SDK Build-tools, revision (Obsolete)
  14. - Android SDK Build-tools, revision (Obsolete)
  15. - Android SDK Build-tools, revision (Obsolete)
  16. - Android SDK Build-tools, revision (Obsolete)
  17. - Android SDK Build-tools, revision (Obsolete)
  18. - Android SDK Build-tools, revision 18.1 (Obsolete)
  19. - Android SDK Build-tools, revision (Obsolete)
  20. - Android SDK Build-tools, revision (Obsolete)
  21. - Documentation , revision
  22. - SDK Platform Android , API , revision
  23. - SDK Platform Android , API , revision
  24. - SDK Platform Android .4W., API , revision
  25. - SDK Platform Android , API , revision
  26. - SDK Platform Android , API , revision
  27. - SDK Platform Android , API , revision

下载需要的组件, 注意--all 这个参数一定要加上, 否则后面filter里的序号不起作用, 例如我用的是

 
   
  1. android update sdk -u --all --filter ,,,,,,,,,,,,,,,

然后等待其安装完成就可以了