问题描述

使用SDK Manager更新时出现问题
Failed to fetch URL https://dl-ssl.google.com/android/repository/repository-6.xml, reason: Connection to https://dl-ssl.google.com refused
Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-1.xml, reason: Connection to http://dl-ssl.google.com refused
Failed to fetch URL https://dl-ssl.google.com/android/repository/addons_list-1.xml, reason: hostname in certificate didn't match: !=
更新ADT时无法解析https://dl-ssl.google.com/android/eclipse


解决办法

由于某些众所周知又无法理解的原因,我们大陆使用Google的服务会出现种种问题,譬如Android开发也会出现阻碍。不过首先要说明的是一般情况下使用SDK Manager更新或者更新Eclipse的ADT插件是没有问题的,我以前也能正常更新,但是昨天不知道节点抽什么风,压根无法连接服务器,出现了上边的种种问题,下面说一下如果网络抽风的话应该如何解决问题。

第一种方法一劳永逸,直接配置×××,但是现在想找个速度快又稳定还免费的×××实在不易,尤其是更新SDK,以几kb/s的速度一个文件需要400多分钟,所以也就放弃了×××。

另一种方法是使用http协议而不是https协议,因为https协议进行了加密处理,大陆因为无法审查,直接封死,而http协议则进行过滤处理,如果不访问乱七八糟的东西,更新个SDK还是没问题的。
在SDK Manager下Tools->Options打开了SDK Manager的Settings,选中“Force https://… sources to be fetched using http://…”,强制使用http协议。
而在更新ADT插件的时候则使用网址http://dl-ssl.google.com/android/eclipse,而不是https://dl-ssl.google.com/android/eclipse,这个在官方开发文档里也有介绍。
但是昨天的情况就是使用http协议也无法访问。

再说一个比较麻烦的方法,就是直接打开
https://dl-ssl.google.com/android/repository/addons_list.xml
https://dl-ssl.google.com/android/repository/repository.xml
https://dl-ssl.google.com/android/repository/addon.xml
这几个文件,找到你要下载的文件名,直接用迅雷下载,ADT可以直接在官网下载ADT包进行安装。具体方法自己搜索。

最好的方法还是改hosts文件的方法,更新速度较快。Windows在C:\WINDOWS\system32\drivers\etc目录下,Linux用户打开/etc/hosts文件。
打开文件后添加以下内容。

#Google主页
203.208.46.146 www.google.com
#这行是为了方便打开Android开发官网 现在好像不×××也可以打开
74.125.113.121 developer.android.com
#更新的内容从以下地址下载
203.208.46.146 dl.google.com
203.208.46.146 dl-ssl.google.com

更多相关文章

  1. Android(安卓)SeekBar的使用
  2. Android(安卓)Studio 基础控件使用
  3. android:windowSoftInputMode属性使用
  4. android时间控件DigitalClock的使用
  5. Android中VectorDrawableCompat的使用注意事项
  6. 【Android(安卓)安装包优化】Android(安卓)中使用 SVG 图片 ( An
  7. Android(安卓)Studio系列教程三--快捷键
  8. 创建一个ArcGIS for Android(安卓)新项目并显示出本地的地图
  9. Android创建和使用数据库详细指南

随机推荐

  1. Android(安卓)网络调试
  2. Android(安卓)9 (P)之init进程启动源码分
  3. Android公共库(缓存,下拉ListView,下载管
  4. android报表例子
  5. android 热更新(无框架)
  6. android中的selector背景选择器的用法
  7. Android应用开发——TextView控件属性列
  8. Android系统分析之Activity的启动流程
  9. android通过adb设置以太网共享
  10. Android调用shell脚本并获得输出