博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
离线安装配置Android SDK方法
阅读量:5966 次
发布时间:2019-06-19

本文共 9939 字,大约阅读时间需要 33 分钟。

hot3.png

1. 安装SDK

   下载Android SDK 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. 直到安装全部完成。

06202809_LiSJ.jpg

                       图1 

06202810_yaJb.jpg

                          图2

3. 重启Eclipse

在重启之后,会提示设置SDK的安装路径,或者提示SDK的安装不完全,点击确定启动Android SDK Manager,在看到图5所示的图像时,等待载入完成(Done loading packages),这样你会看到那些包还没有安装。

4. 完成离线安装

将安装第5节方法下载好的zip文件,全部复制到SDK安装目录根目录下的temp文件夹内,不要嵌套其他子文件夹。 然后勾选相应的要安装的包,即可瞬间完成安装,不必等待其缓慢的下载速度。

06203204_eTQr.jpg

06203205_nmca.jpg

                              图3

5. 原理

查看SDK Manager Log发现每次更新时,SDK Manager 都下载以下5个xml文件:

"http://dl-ssl.google.com/android/repository/repository-7.xml";"http://dl-ssl.google.com/android/repository/addon.xml";"http://software.intel.com/sites/landingpage/android/addon.xml";"http://www.mips.com/global/sdk-sys-img.xml";"http://download-software.intel.com/sites/landingpage/android/sys-img.xml";

编写一个简单程序,将其中的名为url的标签对应的内容,拼接在路径http://dl-ssl.google.com/android/repository/后面,即可得到所有需要的安装包的下载地址,然后可以用迅雷等下载工具进行下载,将下载好的包拷贝到SDK根目录下的temp文件夹内,再点安装时,即可直接安装,节省大量时间。(在天朝安装这些包,之有几KB的下载速度)

以下附上代码:

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 
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.ziphttp://dl-ssl.google.com/android/repository/android-1.1_r1-macosx.ziphttp://dl-ssl.google.com/android/repository/android-1.1_r1-linux.ziphttp://dl-ssl.google.com/android/repository/android-1.5_r04-windows.ziphttp://dl-ssl.google.com/android/repository/android-1.5_r04-macosx.ziphttp://dl-ssl.google.com/android/repository/android-1.5_r04-linux.ziphttp://dl-ssl.google.com/android/repository/android-1.6_r03-linux.ziphttp://dl-ssl.google.com/android/repository/android-1.6_r03-macosx.ziphttp://dl-ssl.google.com/android/repository/android-1.6_r03-windows.ziphttp://dl-ssl.google.com/android/repository/android-2.0_r01-linux.ziphttp://dl-ssl.google.com/android/repository/android-2.0_r01-macosx.ziphttp://dl-ssl.google.com/android/repository/android-2.0_r01-windows.ziphttp://dl-ssl.google.com/android/repository/android-2.0.1_r01-linux.ziphttp://dl-ssl.google.com/android/repository/android-2.0.1_r01-macosx.ziphttp://dl-ssl.google.com/android/repository/android-2.0.1_r01-windows.ziphttp://dl-ssl.google.com/android/repository/android-2.1_r03-linux.ziphttp://dl-ssl.google.com/android/repository/android-2.2_r03-linux.ziphttp://dl-ssl.google.com/android/repository/android-2.3.1_r02-linux.ziphttp://dl-ssl.google.com/android/repository/android-2.3.3_r02-linux.ziphttp://dl-ssl.google.com/android/repository/android-3.0_r02-linux.ziphttp://dl-ssl.google.com/android/repository/android-3.1_r03-linux.ziphttp://dl-ssl.google.com/android/repository/android-3.2_r01-linux.ziphttp://dl-ssl.google.com/android/repository/android-14_r03.ziphttp://dl-ssl.google.com/android/repository/android-15_r03.ziphttp://dl-ssl.google.com/android/repository/android-16_r03.ziphttp://dl-ssl.google.com/android/repository/android-17_r01.ziphttp://dl-ssl.google.com/android/repository/sysimg_armv7a-14_r02.ziphttp://dl-ssl.google.com/android/repository/sysimg_armv7a-15_r02.ziphttp://dl-ssl.google.com/android/repository/sysimg_armv7a-16_r03.ziphttp://dl-ssl.google.com/android/repository/sysimg_armv7a-17_r01.ziphttp://dl-ssl.google.com/android/repository/samples-2.1_r01-linux.ziphttp://dl-ssl.google.com/android/repository/samples-2.2_r01-linux.ziphttp://dl-ssl.google.com/android/repository/samples-2.3_r01-linux.ziphttp://dl-ssl.google.com/android/repository/samples-2.3.3_r01-linux.ziphttp://dl-ssl.google.com/android/repository/samples-3.0_r01-linux.ziphttp://dl-ssl.google.com/android/repository/samples-3.1_r01-linux.ziphttp://dl-ssl.google.com/android/repository/samples-3.2_r01-linux.ziphttp://dl-ssl.google.com/android/repository/samples-14_r02.ziphttp://dl-ssl.google.com/android/repository/samples-15_r02.ziphttp://dl-ssl.google.com/android/repository/samples-16_r01.ziphttp://dl-ssl.google.com/android/repository/samples-17_r01.ziphttp://dl-ssl.google.com/android/repository/platform-tools_r16-windows.ziphttp://dl-ssl.google.com/android/repository/platform-tools_r16-linux.ziphttp://dl-ssl.google.com/android/repository/platform-tools_r16-macosx.ziphttp://dl-ssl.google.com/android/repository/tools_r21-windows.ziphttp://dl-ssl.google.com/android/repository/tools_r21-linux.ziphttp://dl-ssl.google.com/android/repository/tools_r21-macosx.ziphttp://dl-ssl.google.com/android/repository/tools_r21.0.1_rc1-windows.ziphttp://dl-ssl.google.com/android/repository/tools_r21.0.1_rc1-linux.ziphttp://dl-ssl.google.com/android/repository/tools_r21.0.1_rc1-macosx.ziphttp://dl-ssl.google.com/android/repository/docs-17_r01.ziphttp://dl-ssl.google.com/android/repository/sources-14_r01.ziphttp://dl-ssl.google.com/android/repository/sources-15_r02.ziphttp://dl-ssl.google.com/android/repository/sources-16_r02.ziphttp://dl-ssl.google.com/android/repository/sources-17_r01.ziphttp://dl-ssl.google.com/android/repository/google_apis-3-r03.ziphttp://dl-ssl.google.com/android/repository/google_apis-4_r02.ziphttp://dl-ssl.google.com/android/repository/google_apis-5_r01.ziphttp://dl-ssl.google.com/android/repository/google_apis-6_r01.ziphttp://dl-ssl.google.com/android/repository/google_apis-7_r01.ziphttp://dl-ssl.google.com/android/repository/google_apis-8_r02.ziphttp://dl-ssl.google.com/android/repository/google_apis-9_r02.ziphttp://dl-ssl.google.com/android/repository/google_apis-10_r02.ziphttp://dl-ssl.google.com/android/repository/google_apis-11_r01.ziphttp://dl-ssl.google.com/android/repository/google_apis-12_r01.ziphttp://dl-ssl.google.com/android/repository/google_apis-13_r01.ziphttp://dl-ssl.google.com/android/repository/google_apis-14_r02.ziphttp://dl-ssl.google.com/android/repository/google_apis-15_r02.ziphttp://dl-ssl.google.com/android/repository/google_apis-16_r03.ziphttp://dl-ssl.google.com/android/repository/google_tv-12_r02.ziphttp://dl-ssl.google.com/android/repository/google_apis-17_r01.ziphttp://dl-ssl.google.com/android/repository/support_r11.ziphttp://dl-ssl.google.com/android/repository/market_licensing-r02.ziphttp://dl-ssl.google.com/android/repository/market_apk_expansion-r02.ziphttp://dl-ssl.google.com/android/repository/google_play_services_2010110_r03.ziphttp://dl-ssl.google.com/android/repository/usb_driver_r07-windows.ziphttp://dl-ssl.google.com/android/repository/market_billing_r02.ziphttps://dl-ssl.google.com/googleadmobadssdk/googleadmobadssdkandroid-6.2.1.ziphttps://dl.google.com/gaformobileapps/GoogleAnalyticsAndroid_1.4.2.ziphttp://dl-ssl.google.com/android/repository/webdriver_r02.ziphttp://dl-ssl.google.com/android/repository/gcm_r03.ziphttp://dl-ssl.google.com/android/repository/addon_intel_sysimg_2.3.7_api-10.ziphttp://dl-ssl.google.com/android/repository/http://download-software.intel.com/sites/landingpage/android/extra_intel_haxm-windows_r02.ziphttp://dl-ssl.google.com/android/repository/http://download-software.intel.com/sites/landingpage/android/extra_intel_haxm-macosx_r02.ziphttp://dl-ssl.google.com/android/repository/http://d2a85uzpvoidrc.cloudfront.net/sysimg_mips-15_r01.ziphttp://dl-ssl.google.com/android/repository/http://d2a85uzpvoidrc.cloudfront.net/sysimg_mips-16_r02.ziphttp://download-software.intel.com/sites/landingpage/android/sysimg_x86-15_r01.ziphttp://download-software.intel.com/sites/landingpage/android/sysimg_x86-16_r01.zip

转载于:https://my.oschina.net/unclegeek/blog/94364

你可能感兴趣的文章
Dockerfile构建LNMP分离环境部署wordpress
查看>>
网络中最常用的网络命令(5)-完整参数
查看>>
[unity3d]Assetbundle使用示例2(支持多平台)
查看>>
實用 SMTP 指令
查看>>
Exchange Server 2010部署安装之一
查看>>
重建控制文件--Rebuild controlfile
查看>>
PhotoShop的神奇(重新发表)
查看>>
集群节点列表编辑程序
查看>>
Nsrp实现juniper防火墙的高可用性【HA】!
查看>>
Linux下磁盘阵列raid
查看>>
Android 动态移动控件实现
查看>>
oracle11g 安装在rhel5.0笔记
查看>>
解决Lync 2013演示PPT提示证书问题的多种方法
查看>>
VC++动态链接库(DLL)编程(三)――MFC规则DLL
查看>>
[转]经典正则表达式
查看>>
JDBC+Servlet+JSP整合开发之26.JSP内建对象
查看>>
【下载】深入oracle数据库专用虚拟机环境部署方案《VirtualBox+OELR5U7x86_64+Oracle11gR2》...
查看>>
[Web开发] IE8 网页开发参考文档
查看>>
值得推荐的C/C++开源框架和库
查看>>
列式存储
查看>>