用命令行方式升级Android SDK

Posted skiwnywh

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用命令行方式升级Android SDK相关的知识,希望对你有一定的参考价值。

为什么用命令行?因为google站点国内很难访问,用android SDK Manager下载很麻烦。但是我有美国的服务器,用命令行可以升级SDK,然后复制下来。

1. 安装java

Ubuntu 13.10 安装Oralce JDK

2. 下载Android SDK

 

wget http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz 

解压后,进入目录的tools目录,执行:

 

 

[email protected]:/opt/android-sdk-linux/tools# ./android list sdk
Refresh Sources:
  Fetching https://dl-ssl.google.com/android/repository/addons_list-2.xml
  Validate XML
  Parse XML
  Fetched Add-ons List successfully
  Refresh Sources
  Fetching URL: https://dl-ssl.google.com/android/repository/repository-10.xml
  Validate XML: https://dl-ssl.google.com/android/repository/repository-10.xml
  Parse XML:    https://dl-ssl.google.com/android/repository/repository-10.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/addon.xml
  Validate XML: https://dl-ssl.google.com/android/repository/addon.xml
  Parse XML:    https://dl-ssl.google.com/android/repository/addon.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/addon-6.xml
  Validate XML: https://dl-ssl.google.com/android/repository/addon-6.xml
  Parse XML:    https://dl-ssl.google.com/android/repository/addon-6.xml
  Fetching URL: https://dl-ssl.google.com/glass/gdk/addon.xml
  Validate XML: https://dl-ssl.google.com/glass/gdk/addon.xml
  Parse XML:    https://dl-ssl.google.com/glass/gdk/addon.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/extras/intel/addon.xml
  Validate XML: https://dl-ssl.google.com/android/repository/extras/intel/addon.xml
  Parse XML:    https://dl-ssl.google.com/android/repository/extras/intel/addon.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
  Parse XML:    https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Parse XML:    https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Parse XML:    https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/google_apis/sys-img.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/google_apis/sys-img.xml
  Parse XML:    https://dl-ssl.google.com/android/repository/sys-img/google_apis/sys-img.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
  Parse XML:    https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
Packages available for installation or update: 66
   1- Android SDK Tools, revision 23.0.5
   2- Android SDK Platform-tools, revision 21
   3- Android SDK Build-tools, revision 21.1.1
   4- Documentation for Android SDK, API 21, revision 1
   5- SDK Platform Android 5.0, API 21, revision 1
   6- SDK Platform Android 4.4W.2, API 20, revision 2
   7- SDK Platform Android 4.4.2, API 19, revision 4
   8- SDK Platform Android 4.3.1, API 18, revision 3
   9- SDK Platform Android 4.2.2, API 17, revision 3
  10- SDK Platform Android 4.1.2, API 16, revision 5
  11- SDK Platform Android 4.0.3, API 15, revision 5
  12- SDK Platform Android 4.0, API 14, revision 4
  13- SDK Platform Android 3.2, API 13, revision 1
  14- SDK Platform Android 3.1, API 12, revision 3
  15- SDK Platform Android 3.0, API 11, revision 2
  16- SDK Platform Android 2.3.3, API 10, revision 2
  17- SDK Platform Android 2.2, API 8, revision 3
  18- SDK Platform Android 2.1, API 7, revision 3
  19- SDK Platform Android 1.6, API 4, revision 3
  20- SDK Platform Android 1.5, API 3, revision 4
  21- Samples for SDK API 21, revision 3
  22- Samples for SDK API 20, revision 3
  23- Samples for SDK API 19, revision 6
  24- Samples for SDK API 18, revision 1
  25- Samples for SDK API 17, revision 1
  26- Samples for SDK API 16, revision 1
  27- Samples for SDK API 15, revision 2
  28- Samples for SDK API 14, revision 2
  29- Samples for SDK API 13, revision 1
  30- Samples for SDK API 12, revision 1
  31- Samples for SDK API 11, revision 1
  32- Samples for SDK API 10, revision 1
  33- Samples for SDK API 8, revision 1
  34- Samples for SDK API 7, revision 1
  35- Google APIs ARM EABI v7a System Image, Google Inc. API 21, revision 2
  36- Google APIs Intel x86 Atom_64 System Image, Google Inc. API 21, revision 2
  37- Google APIs Intel x86 Atom System Image, Google Inc. API 21, revision 2
  38- Google APIs, Android API 21, revision 1
  39- Google APIs (x86 System Image), Android API 19, revision 9
  40- Google APIs (ARM System Image), Android API 19, revision 9
  41- Glass Development Kit Preview, Android API 19, revision 11
  42- Google APIs, Android API 18, revision 3
  43- Google APIs, Android API 17, revision 3
  44- Google APIs, Android API 16, revision 3
  45- Google APIs, Android API 15, revision 2
  46- Google APIs, Android API 14, revision 2
  47- Google APIs, Android API 13, revision 1
  48- Google TV Addon, Android API 13, revision 1
  49- Google APIs, Android API 12, revision 1
  50- Google TV Addon, Android API 12, revision 2
  51- Google APIs, Android API 11, revision 1
  52- Google APIs, Android API 10, revision 2
  53- Google APIs, Android API 8, revision 2
  54- Google APIs, Android API 7, revision 1
  55- Google APIs, Android API 4, revision 2
  56- Google APIs, Android API 3, revision 3
  57- Android Support Repository, revision 9
  58- Android Support Library, revision 21.0.2
  59- Google Play services for Froyo, revision 12
  60- Google Play services, revision 21
  61- Google Repository, revision 13
  62- Google Play APK Expansion Library, revision 3
  63- Google Play Billing Library, revision 5
  64- Google Play Licensing Library, revision 2
  65- Android Auto API Simulators, revision 1
  66- Google Web Driver, revision 2

 

 

好快啊,现在选择想要的安装吧。

这时候可能会遇到adb找不到文件的错误,安装下面两个包:

 

apt-get install lib32stdc++6
apt-get install lib32z1
 

 

可以安装了,用下面的命令:

 

./android update sdk --no-ui --filter 2

也可以不加--filter参数,全部下载

 

android update sdk --no-ui --all --force

 

然后复制到自己的电脑上吧。


再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow






以上是关于用命令行方式升级Android SDK的主要内容,如果未能解决你的问题,请参考以下文章

用java或C#调用命令行对android工程进行编译、打包和签名,急求!!

Android sdk manager 无法打开怎么解决

Android 命令行工具Android 命令行工具简介 ( 官方文档 | SDK 命令行工具 | SDK 构建工具 | SDK 平台工具 | 模拟器工具 | Jetifier 工具 )

如何用-cmd--命令行进入android sdk的安装目录

Android 逆向Android 进程注入工具开发 ( Visual Studio 开发 Android NDK 应用 | Visual Studio 中 SDK 和 NDK 安装位置 )(代码片段

Linux命令行安装配置Android SDK