因为是首次安装,所有有比较多的版本可下载。

我们可以有2个选择:
安装所有版本的SDK 只安装我们应该SDK版本
因为是在服务器上,建议直接调试所有版本的吧,不然后续可能有些app应该这个版本,又有的还要那个版本。还不如一起初就全部安装好。
根据前面的软件使用帮助,可以发现升级命令是使用update sdk,
但是这个命令又是如何使用的呢?查看帮助

$ ./android update sdk --help
Usage:
android [global options] update sdk [action options]
Global options:
-s --silent : Silent mode, shows errors only.
-v --verbose : Verbose mode, shows errors, warnings and all messages.
--clear-cache: Clear the SDK Manager repository manifest cache.
-h --help : Help on a specific command.
Action "update sdk":
Updates the SDK by suggesting new platforms to install if available.
Options:
-f --force : Forces replacement of a package or its parts, even if
something has been modified.
-n --dry-mode : Simulates the update but does not download or install
anything.
--proxy-host: HTTP/HTTPS proxy host (overrides settings if defined)
-s --no-https : Uses HTTP instead of HTTPS (the default) for downloads.
-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'.
-u --no-ui : Updates from command-line (does not display the GUI)
--proxy-port: HTTP/HTTPS proxy port (overrides settings if defined)
-p --obsolete : Deprecated. Please use --all instead.
-a --all : Includes all packages (such as obsolete and non-dependent
ones.)
在这里,重点关注-u和-t参数就好。
-u --no-ui 表示在命令行环境下使用,刚好符合我们服务器环境 -t --filter 表示过滤,只安装指定版本的sdk
好了,我们今天就开始升级吧
首先下载更新全部可安装的SDK版本,不指定过滤即可 $ ./android update sdk -u

经过漫长时间的等待基本都调试好了。。
如果只应该调试指定版本的话,就还要过滤了,如何过滤呢?我们前面已经介绍查看可加装升级sdk版本命令list sdk了。根据查看到的序号过滤即可。
只安装指定序号的版本
$ ./android update sdk -u -t 序号
如:安装Build-tools, revision 24.0.3
$ ./android update sdk -u -t 3
需要同意license,输入 y 回车即可
安装后可跳转到上一级目录查看是否将要有了。
$ cd ..
$ ls
add-ons build-tools platforms SDK Readme.txt temp tools
$ cd build-tools
$ ls
24.0.3
可以发现安装成功了。
通过很多我们也可以推断出貌似那些IDE图形界面底层读取的也是很多命令吧。。
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/ruanjian/article-120310-2.html
美国在叙利亚的拙败后的又一出恶作剧
机