离线安装配置Android SDK方法
2014-02-07 10:13
856 查看
1. 安装SDK
下载AndroidSDK Tools only(不包含ADT和其他包),目前最新版本是r21,双击安装或者下载zip包直接解压到指定目录即可。
2. 安装Eclipse ADT plugin
下载最新版ADT,ADT-21.0.0.zip,在Eclipse中,点击Help->install new software->add 将压缩包的路径添加到源,然后选中刚刚添加的源,勾选要安装的Developer Tools,取消勾选Contact all update sites during install,然后点next. 直到安装全部完成。图1
图2
3. 重启Eclipse
在重启之后,会提示设置SDK的安装路径,或者提示SDK的安装不完全,点击确定启动Android SDK Manager,在看到图5所示的图像时,等待载入完成(Done loading packages),这样你会看到那些包还没有安装。
4. 完成离线安装
将安装第5节方法下载好的zip文件,全部复制到SDK安装目录根目录下的temp文件夹内,不要嵌套其他子文件夹。 然后勾选相应的要安装的包,即可瞬间完成安装,不必等待其缓慢的下载速度。图3
5. 原理
查看SDK Manager Log发现每次更新时,SDK Manager 都下载以下5个xml文件:view
source
print?
1 | "http://dl-ssl.google.com/android/repository/repository-7.xml" ; |
2 | "http://dl-ssl.google.com/android/repository/addon.xml" ; |
3 | "http://software.intel.com/sites/landingpage/android/addon.xml" ; |
4 | "http://www.mips.com/global/sdk-sys-img.xml" ; |
5 | "http://download-software.intel.com/sites/landingpage/android/sys-img.xml" ; |
以下附上代码:
package urlfinder; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.Iterator; import java.util.List; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; import org.dom4j.io.SAXReader; /** * This program allow you to catch the URL of the installation packages * download by Android SDK Manager. Run this program and get packages'URLs * in the urlfile.txt, copy them to Download Tools to download them faster. * (The speed is extremely slow in China.) * Copy the downloaded packages to {your installation path of Android SDK}/temp * and install them fast in SDK Manager. Enjoy. * * @author ZQY * */ public class UrlFinder { /* the XML files the SDK Manager read... */ public static final String repository = "http://dl-ssl.google.com/android/repository/repository-7.xml"; public static final String addon = "http://dl-ssl.google.com/android/repository/addon.xml"; public static final String addon2 = "http://software.intel.com/sites/landingpage/android/addon.xml"; public static final String sysimg = "http://www.mips.com/global/sdk-sys-img.xml"; public static final String sysimg2 = "http://download-software.intel.com/sites/landingpage/android/sys-img.xml"; public static final String[] repos = { repository, addon, addon2, sysimg, sysimg2 }; public static void main(String[] args) throws MalformedURLException, DocumentException { BufferedWriter out = null; try { File file = new File("urlfile.txt"); out = new BufferedWriter(new FileWriter(file)); for (String repo : repos) { Document doc = read(repo); findurl(doc.getRootElement(), out); } out.close(); } catch (FileNotFoundException e) { System.err.println("URL does not exits."); } catch (IOException e) { System.err.println("error write output file."); } } /* find the <sdk:url/> tag, and get the absolute path of the file */ public static void findurl(Element element, BufferedWriter out) throws IOException { List<?> list = element.elements(); for (Iterator<?> its = list.iterator(); its.hasNext();) { Element e = (Element) its.next(); if (e.getName().equals("url")) { System.out.println("Found:" + e.getText()); out.write("http://dl-ssl.google.com/android/repository/" + e.getText() + "\n"); } findurl(e, out); } } public static Document read(String fileName) throws MalformedURLException, DocumentException { SAXReader reader = new SAXReader(); Document document = reader.read(new URL(fileName)); return document; } }
抓取到的下载路径:
http://dl-ssl.google.com/android/repository/android-1.1_r1-windows.zip http://dl-ssl.google.com/android/repository/android-1.1_r1-macosx.zip http://dl-ssl.google.com/android/repository/android-1.1_r1-linux.zip http://dl-ssl.google.com/android/repository/android-1.5_r04-windows.zip http://dl-ssl.google.com/android/repository/android-1.5_r04-macosx.zip http://dl-ssl.google.com/android/repository/android-1.5_r04-linux.zip http://dl-ssl.google.com/android/repository/android-1.6_r03-linux.zip http://dl-ssl.google.com/android/repository/android-1.6_r03-macosx.zip http://dl-ssl.google.com/android/repository/android-1.6_r03-windows.zip http://dl-ssl.google.com/android/repository/android-2.0_r01-linux.zip http://dl-ssl.google.com/android/repository/android-2.0_r01-macosx.zip http://dl-ssl.google.com/android/repository/android-2.0_r01-windows.zip http://dl-ssl.google.com/android/repository/android-2.0.1_r01-linux.zip http://dl-ssl.google.com/android/repository/android-2.0.1_r01-macosx.zip http://dl-ssl.google.com/android/repository/android-2.0.1_r01-windows.zip http://dl-ssl.google.com/android/repository/android-2.1_r03-linux.zip http://dl-ssl.google.com/android/repository/android-2.2_r03-linux.zip http://dl-ssl.google.com/android/repository/android-2.3.1_r02-linux.zip http://dl-ssl.google.com/android/repository/android-2.3.3_r02-linux.zip http://dl-ssl.google.com/android/repository/android-3.0_r02-linux.zip http://dl-ssl.google.com/android/repository/android-3.1_r03-linux.zip http://dl-ssl.google.com/android/repository/android-3.2_r01-linux.zip http://dl-ssl.google.com/android/repository/android-14_r03.zip http://dl-ssl.google.com/android/repository/android-15_r03.zip http://dl-ssl.google.com/android/repository/android-16_r03.zip http://dl-ssl.google.com/android/repository/android-17_r01.zip http://dl-ssl.google.com/android/repository/sysimg_armv7a-14_r02.zip http://dl-ssl.google.com/android/repository/sysimg_armv7a-15_r02.zip http://dl-ssl.google.com/android/repository/sysimg_armv7a-16_r03.zip http://dl-ssl.google.com/android/repository/sysimg_armv7a-17_r01.zip http://dl-ssl.google.com/android/repository/samples-2.1_r01-linux.zip http://dl-ssl.google.com/android/repository/samples-2.2_r01-linux.zip http://dl-ssl.google.com/android/repository/samples-2.3_r01-linux.zip http://dl-ssl.google.com/android/repository/samples-2.3.3_r01-linux.zip http://dl-ssl.google.com/android/repository/samples-3.0_r01-linux.zip http://dl-ssl.google.com/android/repository/samples-3.1_r01-linux.zip http://dl-ssl.google.com/android/repository/samples-3.2_r01-linux.zip http://dl-ssl.google.com/android/repository/samples-14_r02.zip http://dl-ssl.google.com/android/repository/samples-15_r02.zip http://dl-ssl.google.com/android/repository/samples-16_r01.zip http://dl-ssl.google.com/android/repository/samples-17_r01.zip http://dl-ssl.google.com/android/repository/platform-tools_r16-windows.zip http://dl-ssl.google.com/android/repository/platform-tools_r16-linux.zip http://dl-ssl.google.com/android/repository/platform-tools_r16-macosx.zip http://dl-ssl.google.com/android/repository/tools_r21-windows.zip http://dl-ssl.google.com/android/repository/tools_r21-linux.zip http://dl-ssl.google.com/android/repository/tools_r21-macosx.zip http://dl-ssl.google.com/android/repository/tools_r21.0.1_rc1-windows.zip http://dl-ssl.google.com/android/repository/tools_r21.0.1_rc1-linux.zip http://dl-ssl.google.com/android/repository/tools_r21.0.1_rc1-macosx.zip http://dl-ssl.google.com/android/repository/docs-17_r01.zip http://dl-ssl.google.com/android/repository/sources-14_r01.zip http://dl-ssl.google.com/android/repository/sources-15_r02.zip http://dl-ssl.google.com/android/repository/sources-16_r02.zip http://dl-ssl.google.com/android/repository/sources-17_r01.zip http://dl-ssl.google.com/android/repository/google_apis-3-r03.zip http://dl-ssl.google.com/android/repository/google_apis-4_r02.zip http://dl-ssl.google.com/android/repository/google_apis-5_r01.zip http://dl-ssl.google.com/android/repository/google_apis-6_r01.zip http://dl-ssl.google.com/android/repository/google_apis-7_r01.zip http://dl-ssl.google.com/android/repository/google_apis-8_r02.zip http://dl-ssl.google.com/android/repository/google_apis-9_r02.zip http://dl-ssl.google.com/android/repository/google_apis-10_r02.zip http://dl-ssl.google.com/android/repository/google_apis-11_r01.zip http://dl-ssl.google.com/android/repository/google_apis-12_r01.zip http://dl-ssl.google.com/android/repository/google_apis-13_r01.zip http://dl-ssl.google.com/android/repository/google_apis-14_r02.zip http://dl-ssl.google.com/android/repository/google_apis-15_r02.zip http://dl-ssl.google.com/android/repository/google_apis-16_r03.zip http://dl-ssl.google.com/android/repository/google_tv-12_r02.zip http://dl-ssl.google.com/android/repository/google_apis-17_r01.zip http://dl-ssl.google.com/android/repository/support_r11.zip http://dl-ssl.google.com/android/repository/market_licensing-r02.zip http://dl-ssl.google.com/android/repository/market_apk_expansion-r02.zip http://dl-ssl.google.com/android/repository/google_play_services_2010110_r03.zip http://dl-ssl.google.com/android/repository/usb_driver_r07-windows.zip http://dl-ssl.google.com/android/repository/market_billing_r02.zip https://dl-ssl.google.com/googleadmobadssdk/googleadmobadssdkandroid-6.2.1.zip https://dl.google.com/gaformobileapps/GoogleAnalyticsAndroid_1.4.2.zip http://dl-ssl.google.com/android/repository/webdriver_r02.zip http://dl-ssl.google.com/android/repository/gcm_r03.zip http://dl-ssl.google.com/android/repository/addon_intel_sysimg_2.3.7_api-10.zip http://dl-ssl.google.com/android/repository/http://download-software.intel.com/sites/landingpage/android/extra_intel_haxm-windows_r02.zip http://dl-ssl.google.com/android/repository/http://download-software.intel.com/sites/landingpage/android/extra_intel_haxm-macosx_r02.zip http://dl-ssl.google.com/android/repository/http://d2a85uzpvoidrc.cloudfront.net/sysimg_mips-15_r01.zip http://dl-ssl.google.com/android/repository/http://d2a85uzpvoidrc.cloudfront.net/sysimg_mips-16_r02.zip http://download-software.intel.com/sites/landingpage/android/sysimg_x86-15_r01.zip http://download-software.intel.com/sites/landingpage/android/sysimg_x86-16_r01.zip[/code]
用迅雷下载完成后,把相应的zip包放到sdk/temp目录下。再次打开SDK Manager.exe,勾选相应的sdk进行安装。完成离线安装
相关文章推荐
- 离线安装配置Android SDK方法
- 离线安装配置Android SDK方法
- (笔记) BT5 Nessus安装、配置、离线升级和插件调试方法
- Android SDK 各API 离线安装方法
- mysql8.0.2离线安装配置方法图文教程
- Android SDK下载和更新失败的解决方法 分类: Android安装及配置 2014-12-15 23:11 168人阅读 评论(0) 收藏
- Android SDK 安装中组件的离线安装方法 (share)
- Android SDK离线安装方法详解(加速安装)
- Android SDK离线安装方法详解(加速安装)(转载)
- Android SDK离线安装方法详解(加速安装)
- android studio 和ADT_bundle eclipse的 Android SDK 离线更新升级安装方法大全V.20150210
- SharePoint 2016 企业项目管理应用(三,基础安装配置SahrePoint 2016 Web端安装)中文离线方法
- Windows下离线安装Android SDK的简单方法
- Android SDK离线安装方法详解(加速安装)
- Android SDK离线安装方法详解(加速安装)
- Android SDK离线安装方法详解(加速安装)
- Android SDK 环境配置与离线安装问题(校园网)
- 针对文件转移情况的Android SDK离线安装方法
- Android SDK离线安装方法详解(加速安装) 转