linux下通过命令行更新android sdk
/usr/share/android/android-sdk-linux/android
$ android update sdk --no-ui
android provide these options for automatic updates:
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 -u --no-ui Updates from command-line (does not display the GUI) -o --obsolete Installs obsolete packages -t --filter A filter that limits the update to the specified types of packages in the form of a comma-separated list of [platform, tool, platform-tool, doc, sample, extra] -s --no-https Uses HTTP instead of HTTPS (the default) for downloads -n --dry-mode Simulates the update but does not download or install anything
If you want to list which packages are available for installation you can use
$ android list sdk
and you'll obtain an ordered list of packages, for example
Packages available for installation or update: 9 1- ARM EABI v7a System Image, Android API 15, revision 2 2- Intel x86 Atom System Image, Android API 15, revision 1 3- Android Support, revision 8 4- Google AdMob Ads SDK, revision 6 5- Google Analytics SDK, revision 2 6- Google Play APK Expansion Library, revision 1 7- Google Play Billing Library, revision 2 8- Google Play Licensing Library, revision 2 9- Google Web Driver, revision 2
Also you can limit the update only to a desired component if you use the--filter
option
$ android update sdk --filter <component> --no-ui
where component is one or more of
- the numbers returned by
android list sdk
(i.e.1, also know aspackage index) - add-on
- doc
- extra
- platform
- platform-tool
- sample
- source
- system-image
- tool
or can be one or more specific identifiers. For instance, if you just want to download a small set of specific packages, you could do this:
$ android update sdk -u --filter platform-tools,android-16,extra-android-support
and you'll just get the platform tools, api level 16 and support package jar. This is really handy if you're building a build machine only and would have to pay for downloading all the extra stuff that you'll never use.
To see the available options you can use --help, for example
$ 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]
i use this to install and update the sdk on travis-ci
curl --location http://dl.google.com/android/android-sdk_r22.3-linux.tgz | tar -x -z -C $HOME export ANDROID_HOME=$HOME/android-sdk-linux export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools ( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) | android update sdk --no-ui --filter platform-tool,android-19,sysimg-19,build-tools-19.0.1
更多相关文章
- 代码中设置drawableleft
- android 3.0 隐藏 系统标题栏
- Android开发中activity切换动画的实现
- Android(安卓)学习 笔记_05. 文件下载
- Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
- 技术博客汇总
- android 2.3 wifi (一)
- AndRoid Notification的清空和修改
- Android中的Chronometer