下载用于离线安装的 Android SDK 组件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2766713/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Download the Android SDK components for offline install
提问by Tawani
Is it possible to download the Android SDK components for offline install without using the SDK Manager? The problem is I am behind a firewall which I have no control over and both sites download URLs seem to be blocked (throws a connection refused exception)
是否可以在不使用 SDK Manager 的情况下下载 Android SDK 组件进行离线安装?问题是我在防火墙后面,我无法控制,两个站点的下载 URL 似乎都被阻止了(抛出连接被拒绝的异常)
https://dl-ssl.google.com/android/repository/repository.xml
https://dl-ssl.google.com/android/repository/repository.xml
http://dl-ssl.google.com/android/repository/repository.xml
http://dl-ssl.google.com/android/repository/repository.xml
Failed to fetch URL http://dl-ssl.google.com/android/repository/repository.xml, reason: Connection refused: connect
回答by Ankit
To install android component do following steps
要安装 android 组件,请执行以下步骤
- Run android sdk manager on offline machine
- Click on show/hide log window
- here youu will find all the list of xml files where packages are available
- 在离线机器上运行 android sdk 管理器
- 单击显示/隐藏日志窗口
- 在这里你会找到所有可用的 xml 文件列表
Fetching https://dl-ssl.google.com/android/repository/addons_list-2.xml
Fetched Add-ons List successfully
Fetching URL: https://dl-ssl.google.com/android/repository/repository-7.xml
Validate XML: https://dl-ssl.google.com/android/repository/repository-7.xml
Parse XML: https://dl-ssl.google.com/android/repository/repository-7.xml
获取https://dl-ssl.google.com/android/repository/addons_list-2.xml
获取加载项列表成功
获取 URL:https ://dl-ssl.google.com/android/repository/repository-7 .xml
验证 XML:https: //dl-ssl.google.com/android/repository/repository-7.xml
解析 XML:https: //dl-ssl.google.com/android/repository/repository-7.xml
https://dl-ssl.google.com/android/repository/addons_list-2.xmlis main xml file where all other package list is available.
https://dl-ssl.google.com/android/repository/addons_list-2.xml是主要的 xml 文件,所有其他包列表都可用。
lets say you want to download platform api-9 and it is available on repository-7 then you have to do following steps
假设您要下载平台 api-9 并且它在 repository-7 上可用,那么您必须执行以下步骤
note the repository address and go to any other machine which has internet connection and type following link in any browser
https://dl-ssl.google.com/android/repository/repository-7.xml
Search for
<sdk:url>**android-2.3.1_r02-linux.zip**</sdk:url>
under the api version which you want to download. This is the file name which you have to download. to download this file you have to type following URI in any downloader or browser and it will start download the file.http://dl-ssl.google.com/android/repository/android-2.3.3_r02-linux.zip
General rule for any file replace android-2.3.3_r02-linux.zip with your package name
Once the download is complete,paste downloaded ZIP(or other format for other os) file in your flash/pen drive and paste the zip file at
<android sdk dir>/temp
(ex:-c:\android-sdk\temp
) folder/directory in your offline machine.Now start the SDK manager and select the package which you have paste in temp and click Install package button. Your package has been installed.
Restart your eclipse and AVD manager to get new packages.
记下存储库地址并转到任何其他具有 Internet 连接的计算机并在任何浏览器中键入以下链接
https://dl-ssl.google.com/android/repository/repository-7.xml
<sdk:url>**android-2.3.1_r02-linux.zip**</sdk:url>
在您要下载的 api 版本下搜索。这是您必须下载的文件名。要下载此文件,您必须在任何下载器或浏览器中键入以下 URI,它将开始下载文件。http://dl-ssl.google.com/android/repository/android-2.3.3_r02-linux.zip
任何文件的一般规则用你的包名替换 android-2.3.3_r02-linux.zip
下载完成后,将下载的 ZIP(或其他操作系统的其他格式)文件粘贴到您的闪存/笔式驱动器中,然后将 zip 文件粘贴到离线机器的
<android sdk dir>/temp
(例如:-)文件c:\android-sdk\temp
夹/目录中。现在启动 SDK 管理器并选择您在 temp 中粘贴的包,然后单击安装包按钮。您的软件包已安装。
重新启动 eclipse 和 AVD 管理器以获取新包。
Note:- if you are downloading sdk-tools or sdk platform-tools then choose the package for OS which is on offline machine(windows/Linux/Mac).
注意:-如果您要下载 sdk-tools 或 sdk platform-tools,请选择离线机器(windows/Linux/Mac)上的操作系统软件包。
回答by VenomVendor
You can download manually by parsing the XMLs that you see in Android SDK Manager log.
Currently the XMLs are addon_listand repository. These xmls can change over a course of time.
您可以通过解析您在 Android SDK 管理器日志中看到的 XML 来手动下载。
目前 XML 是addon_list和repository。这些 xml 可以随着时间的推移而改变。
It has the location of the SDKs, you can browse to the link and download directly via browser. These files has to be placed under proper folder, example the files of google APIs has to be placed under add-ons
, if you don't know where the files has to go.
它有SDK的位置,您可以浏览到链接并直接通过浏览器下载。这些文件必须放在适当的文件夹下,例如 google API 的文件必须放在 下add-ons
,如果您不知道文件必须去哪里。
Here is something to help you.
The blogpost from my blog to Install Android SDKs offline --> Offline Installation of Android SDK's
这里有一些东西可以帮助你。
我的博客中的博客文章离线安装 Android SDK -->离线安装 Android SDK
回答by Raghav
As said, this error usually comes if u stay behind proxy. So to get with this, open IE-Internet options-Connections-LAN settings and take the proxy address. Configure the SDK Manager.exe (settings tab) to that proxy address with port. Check Force Http....
如上所述,如果您留在代理后面,通常会出现此错误。因此,为此,请打开 IE-Internet 选项-连接-LAN 设置并获取代理地址。使用端口将 SDK Manager.exe(设置选项卡)配置为该代理地址。检查强制 Http....
If u have a Proxy script in your LAN settings, copy the address and paste in address bar. Open the downloaded file in notepad. Find your ip address from ipconfig. In the file, go the subnet range in which your ip falls. Eg: isInNet(resolved_ip, "198.175.111.0", "255.255.255.0") will be true for 198.175.111.53 take the return value: after the word PROXY and use this for configuring SDK Manager.
如果您的 LAN 设置中有代理脚本,请复制地址并粘贴到地址栏中。在记事本中打开下载的文件。从 ipconfig 中查找您的 IP 地址。在文件中,转到您的 ip 所在的子网范围。例如: isInNet(resolved_ip, "198.175.111.0", "255.255.255.0") 对于 198.175.111.53 将是 true 取返回值:在单词 PROXY 之后并使用它来配置 SDK Manager。
Now the SDK will be downloaded happily.
现在SDK就可以愉快的下载了。
回答by Sendi_t
This has changed for android 4.4.2. .. you should look in the repository file and download https://dl-ssl.google.com/android/repository/repository-10.xml
这在 android 4.4.2 中有所改变。.. 您应该查看存储库文件并下载 https://dl-ssl.google.com/android/repository/repository-10.xml
- android-sdk_r20.0.1-windows.zip ( I think that is actually windows specific tools)
- android-19_r03.zip for all platform ( actual api) and store under platforms in #1
- android-sdk_r20.0.1-windows.zip(我认为这实际上是windows特定的工具)
- android-19_r03.zip 适用于所有平台(实际 api)并存储在 #1 中的平台下
In manual install dir structure should look like
在手动安装目录结构应该看起来像
Now you have to..
现在你必须..
- download win SDK helper ( avd/SDK magr): https://dl.google.com/android/android-sdk_r20.0.1-windows.zip
- actual sdk api https://dl-ssl.google.com/android/repository/android-20_r01.zip
- samples https://dl-ssl.google.com/android/repository/samples-19_r05.zip
- images : https://dl-ssl.google.com/android/repository/sys-img/x86/sys-img.xmle.g. https://dl-ssl.google.com/android/repository/sysimg_armv7a-18_r02.zipextract in : “Platforms > Android-4.4.2>"
- platform-tools: https://dl-ssl.google.com/android/repository/platform-tools_r19.0.1-windows.zip
- build-tools: create folder (build-tools at main sdk level) https://dl-ssl.google.com/android/repository/build-tools_r17-windows.zip
- copy aapt.exe, aidl.exe and dr.bat to platform-tools folder.
- you may download tools as well same way
- source: https://dl-ssl.google.com/android/repository/sources-19_r02.zip
- 下载 win SDK helper (avd/SDK magr): https://dl.google.com/android/android-sdk_r20.0.1-windows.zip
- 实际 sdk api https://dl-ssl.google.com/android/repository/android-20_r01.zip
- 示例https://dl-ssl.google.com/android/repository/samples-19_r05.zip
- 图像:https: //dl-ssl.google.com/android/repository/sys-img/x86/sys-img.xml例如https://dl-ssl.google.com/android/repository/sysimg_armv7a-18_r02。 zip解压:“平台 > Android-4.4.2>”
- 平台工具:https: //dl-ssl.google.com/android/repository/platform-tools_r19.0.1-windows.zip
- 构建工具:创建文件夹(主要 sdk 级别的构建工具) https://dl-ssl.google.com/android/repository/build-tools_r17-windows.zip
- 将 aapt.exe、aidl.exe 和 dr.bat 复制到 platform-tools 文件夹中。
- 你也可以用同样的方式下载工具
- 来源:https: //dl-ssl.google.com/android/repository/sources-19_r02.zip
At this point you should have a working android installation.
在这一点上,你应该有一个有效的 android 安装。
回答by Goel
I work behind a firewall on windows and I have the Same problem. But I managed to fix it:
我在 Windows 上的防火墙后面工作,我遇到了同样的问题。但我设法解决了它:
- Close all your internet applications (browsers, downloading tools etc...)
- Start -> Execute -> type
cmd
then hit Enter(displays the command prompt) - Type
netstat
In the results returned, find your Proxy address :
TCP YOURMACHINENAME:PORT DISTANTMACHINE1:PORT TCP YOURMACHINENAME:PORT DISTANTMACHINE2:PORT TCP YOURMACHINENAME:PORT DISTANTMACHINE3:PORT
Your proxy address is one of the DISTANTMACHINEx
- Your proxy port is the port following the ":"
- Retype this proxy address and the proxy port in the "setting" page of android SDK manager
- Tick "force https...http://"
- Retry
- 关闭所有互联网应用程序(浏览器、下载工具等...)
- 开始 -> 执行 -> 输入
cmd
然后点击Enter(显示命令提示符) - 类型
netstat
在返回的结果中,找到您的代理地址:
TCP YOURMACHINENAME:PORT DISTANTMACHINE1:PORT TCP YOURMACHINENAME:PORT DISTANTMACHINE2:PORT TCP YOURMACHINENAME:PORT DISTANTMACHINE3:PORT
您的代理地址是 DISTANTMACHINEx 之一
- 您的代理端口是“:”后面的端口
- 在android SDK管理器的“设置”页面重新输入这个代理地址和代理端口
- 勾选“强制 https...http://”
- 重试
回答by Jürgen Steinblock
Which OS?
哪个操作系统?
Everything you download should be placed in the android-sdk folder (in my case: j:\android-sdk-windows).
你下载的所有东西都应该放在 android-sdk 文件夹中(在我的例子中:j:\android-sdk-windows)。
You can execute "SDK Setup.exe" (or the mac/linux command for this) and download everything and just copy your complete android-sdk folder to another computer. I have the complete SDK + Eclipse + Workspace on an external HDD that I can just plug in to another Computer and it works (except for JDK which should be installed and the AVD's which are located in the user directory). Don't forget to set the ANDROID_HOME environment var to point to your install dir.
您可以执行“SDK Setup.exe”(或用于此的 mac/linux 命令)并下载所有内容,然后将完整的 android-sdk 文件夹复制到另一台计算机。我在外部 HDD 上有完整的 SDK + Eclipse + Workspace,我可以将其插入另一台计算机并且它可以工作(除了应该安装的 JDK 和位于用户目录中的 AVD)。不要忘记将 ANDROID_HOME 环境变量设置为指向您的安装目录。
Update: In the SDK Downloader you have a "force https:// sources to be fetched using http://" checkbox under the settings menu. Maybe check (or if checked) uncheck this may help you to download everthing from your firewalled computer.
更新:在 SDK 下载器中,设置菜单下有一个“强制使用 http:// 获取 https:// 源”复选框。也许选中(或如果选中)取消选中这可能会帮助您从防火墙计算机下载所有内容。
回答by Aakash
Here is how I figured it out. I am behind corporate firewall too.
这是我想出来的方法。我也在企业防火墙后面。
Go to Chrome or your Internet Settings by clicking the wrench in Chrome --> Settings --> Under the Hood --> Network --> Change Proxy Settings
通过单击 Chrome 中的扳手进入 Chrome 或您的 Internet 设置 --> 设置 --> 引擎盖下 --> 网络 --> 更改代理设置
Click on LAN Settings and then Advanced. Copy the proxy server address and port.
单击 LAN 设置,然后单击高级。复制代理服务器地址和端口。
Mostly the connection refused link occurs when trying to download SDK packages through Eclipse.
大多数情况下,连接被拒绝链接发生在尝试通过 Eclipse 下载 SDK 包时。
Navigate to the SDK Manager.exe and double click on it. Once it starts click on Tools --> Options and then enter the proxy server address and the Port #
导航到 SDK Manager.exe 并双击它。启动后,单击工具 --> 选项,然后输入代理服务器地址和端口号
Check the checkbox force https:// to http:// That's it your SDK Manager will now be able to download packages from google remote site without any issue even from behind a firewall.
选中复选框强制 https:// 到 http:// 这样,您的 SDK 管理器现在可以从 google 远程站点下载软件包,即使在防火墙后面也没有任何问题。
I am on Windows by the way. Tried everything and this works great.
顺便说一下,我在 Windows 上。尝试了一切,这很好用。
回答by Kevin Parker
Most of these problems are related to people using Proxies. You can supply the proxy information to the SDK Manager and go from there.
大多数这些问题都与使用代理的人有关。您可以将代理信息提供给 SDK 管理器并从那里开始。
I had the same problem and my solution was to switch to HTTP only and supply my corporate proxy settings.
我遇到了同样的问题,我的解决方案是仅切换到 HTTP 并提供我的公司代理设置。
EDIT:--- If you use Eclipse and have no idea what your proxy is, Open Eclipse, go to Windows->Preferences, Select General->Network, and there you will have several proxy addresses. Eclipse is much better at finding proxies than SDK Manager... Copy the http proxy address from Eclipse to SDK Manager (in "Settings"), and it should work ;)
编辑:--- 如果您使用 Eclipse 并且不知道您的代理是什么,请打开 Eclipse,转到 Windows->首选项,选择常规->网络,您将有几个代理地址。Eclipse 在查找代理方面比 SDK 管理器要好得多……将 http 代理地址从 Eclipse 复制到 SDK 管理器(在“设置”中),它应该可以工作;)
回答by Siddharth B
There is an open source offline package deployer for Windows which I wrote:
我写了一个适用于 Windows 的开源离线包部署器:
http://siddharthbarman.com/apd/
http://siddharthbarman.com/apd/
You can try this out to see if it meets your needs.
您可以尝试一下,看看它是否满足您的需求。
回答by Subrat Behera
follow this video https://www.youtube.com/watch?v=883HjO06_E0for how to download and install Android SDK components manually
按照此视频https://www.youtube.com/watch?v=883HjO06_E0了解如何手动下载和安装 Android SDK 组件