如何从命令行安装旧版本的Android构建工具? [英] How to install old version of Android build tools from command line?

查看:149
本文介绍了如何从命令行安装旧版本的Android构建工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在安装android SDK来创建自动构建服务器.我遇到了一个问题,即我管理的许多基于Gradle的Android项目都依赖于不同的构建工具版本.一些项目仍需要旧的构建工具版本(例如v19.1.0).

I am installing android SDK to create an automated build server. I got into a problem where many Gradle-based Android projects I manage rely on different build tools version. Some of the projects still requiring old build-tools version (e.g. v19.1.0).

我的android-sdk软件包是在构建工具版本20刚刚发布时下载的,因此这是唯一可以通过android update sdk -u --filter build-tools下载的版本.

My android-sdk package was downloaded when build-tools version 20 has just released, so that's the only version available to download via android update sdk -u --filter build-tools.

我尝试调用android update sdk -u --filter build-tools-19.1.0,但是没有用.有没有一种简单的方法可以从命令行安装旧版本的Android构建工具?

I have tried to invoke android update sdk -u --filter build-tools-19.1.0 but it didn't work. Is there an easy way to install old version of Android build tools from command line?

注意:无法通过GUI安装

Note: installing via GUI is not possible

推荐答案

假设您已经下载了适用于Linux的Android SDK,则有两个选项可以从命令行进行更新.

Assuming you have downloaded the Android SDK for linux, you have two options to update from command line.

使用sdk中的 android 工具下载

Download using android tool from the sdk

您还可以选择以无头模式运行,而不是通过GUI运行android sdk管理器.您只需要指定-u(或--no-ui)标志即可.

Instead of running the android sdk manager with a GUI, you also have an option to run in headless mode. You just need to specify -u (or --no-ui) flag.

列出可用于安装或升级的软件包:

To list packages available for installation or upgrade:

$ cd android-sdk-linux
$ ./tools/android list sdk --all
Refresh Sources:
  (...)
  Fetching URL: https://dl.google.com/android/repository/repository-11.xml
  (...)
Packages available for installation or update: 166
   1- Android SDK Tools, revision 24.4.1
   2- Android SDK Tools, revision 25.0.9 rc10
   3- Android SDK Platform-tools, revision 23.1
   4- Android SDK Platform-tools, revision 24 rc1
   5- Android SDK Build-tools, revision 24 rc1
   6- Android SDK Build-tools, revision 23.0.2
   7- Android SDK Build-tools, revision 23.0.1
   8- Android SDK Build-tools, revision 23 (Obsolete)
  (...)
 162- Google Play Billing Library, revision 5
 163- Google Play Licensing Library, revision 2
 164- Android Auto API Simulators, revision 1
 165- Google Web Driver, revision 2
 166- Intel x86 Emulator Accelerator (HAXM installer), revision 6.0.1
 

要下载特定的软件包,您需要在以下命令的列表中指定要安装的项目的编号:

To download specific packages you need to specify the number of the item you want to install from the list in the following command:

$ ./tools/android update sdk -u -a -t [NO_OF_ITEM_TO_BE_INSTALLED]

示例:如果我想安装Android SDK构建工具版本23.0.1,请输入:

Example: if I wanted to install Android SDK build tools revision 23.0.1, I would type in:

$ ./tools/android update sdk -u -a -t 7

手动下载

由于在执行android sdk list时未列出所有软件包(尤其是旧软件包),因此您也可以手动下载内容.您可以手动打开在android sdk list- https:期间显示的XML文件://dl.google.com/android/repository/repository-11.xml

As not every package (especially the old ones) is listed when you do android sdk list, you can also download things manually. You can manually open the XML file that is shown when during android sdk list - https://dl.google.com/android/repository/repository-11.xml

您可以在此处找到指向各种类型下载内容的链接,例如:

You can find there links to various types of things to download, e.g:

  • ADK
  • http://dl.google.com/android/ADT-XX.0.0.zip
  • SDK Tools
  • http://dl.google.com/android/repository/tools_rXX-linux.zip
  • http://dl.google.com/android/repository/tools_rXX-windows.zip
  • http://dl.google.com/android/repository/tools_rXX-macosx.zip
  • Platform Tools
  • http://dl.google.com/android/repository/platform-tools_rXX-linux.zip
  • http://dl.google.com/android/repository/platform-tools_rXX-windows.zip
  • http://dl.google.com/android/repository/platform-tools_rXX-macosx.zip
  • Build Tools
  • http://dl.google.com/android/repository/build-tools_rXX-linux.zip
  • http://dl.google.com/android/repository/build-tools_rXX-windows.zip
  • http://dl.google.com/android/repository/build-tools_rXX-macosx.zip
  • Platforms
  • http://dl.google.com/android/repository/android-XX.zip

要手动下载例如构建工具的19.0.1版本

To manually download e.g. version 19.0.1 of build tools

$ cd android-sdk-linux/build-tools
$ wget http://dl.google.com/android/repository/build-tools_r19.0.1-linux.zip
$ unzip build-tools_r19.0.1-linux.zip
$ mv android-4.4.2 19.0.1
$ rm build-tools_r19.0.1-linux.zip

旁注(ubuntu):

如果您运行的是64位debian/ubuntu,要运行aapt,您将需要安装其他软件包:

If you're running debian/ubuntu 64-bit, to run aapt you will need to install additional packages:

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

如果您正在运行CentO(RedHat),要运行aapt,您将需要安装其他软件包:

If you're running CentOs (RedHat), to run aapt you will need to install additional packages:

sudo yum install zlib.i686 libstd++.i686

在运行aapt时,如果GLIBC 2.14出现错误,并且您不会升级语言环境GLIBC.然后,您需要下载sdk的以下软件包(构建工具,平台工具):

While running aapt, if you get an error with GLIBC 2.14 and you dont wont to upgrade your locale GLIBC. Then u need to download the following packages for sdk (build-tool, platform-tool) :

build-tool: http://dl.google .com/android/repository/build-tools_r23.0.2-linux.zip

build-tool : http://dl.google.com/android/repository/build-tools_r23.0.2-linux.zip

platform-tool: https://dl.google .com/android/repository/platform-tools_r23.0.1-linux.zip

platform-tool : https://dl.google.com/android/repository/platform-tools_r23.0.1-linux.zip

这篇关于如何从命令行安装旧版本的Android构建工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆