zoukankan      html  css  js  c++  java
  • Android SDK更新

    摘自:Android SDK更新以及ADT更新出现问题的解决办法http://blog.sina.com.cn/s/blog_4a94a0db0100y4h7.html

    十分感谢原作者!!!

    问题描述

    使用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: <dl-ssl.google.com> != <www.google.com>
    更新ADT时无法解析https://dl-ssl.google.com/android/eclipse


    解决办法

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

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

    另一种方法是使用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:WINDOWSsystem32driversetc目录下,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

    添加以上的网址,再选用http协议,就可以正常的进行更新了。
    或者也可以什么都不做,过上一两天可能会恢复正常。

    下边贴上使用Google各种服务在修改hosts文件时需要添加的内容。



    #Google Service
    #Chrome 网上应用
    203.208.46.146 chrome.google.com
    203.208.46.146 clients0.google.com
    203.208.46.146 clients1.google.com
    203.208.46.146 clients2.google.com
    203.208.46.146 clients3.google.com
    203.208.46.146 clients4.google.com
    203.208.46.146 www.googleusercontent.com
    203.208.46.146 lh0.googleusercontent.com
    203.208.46.146 lh1.googleusercontent.com
    203.208.46.146 lh2.googleusercontent.com
    203.208.46.146 lh3.googleusercontent.com
    203.208.46.146 lh4.googleusercontent.com
    203.208.46.146 lh5.googleusercontent.com
    203.208.46.146 lh6.googleusercontent.com
    203.208.46.146 clients1.googleusercontent.com
    203.208.46.146 clients2.googleusercontent.com

    #网页快照
    203.208.46.146 webcache.googleusercontent.com

    #Google SSL
    203.208.46.146 encrypted.google.com
    203.208.46.146 encrypted.google.com.hk

    #Google Docs
    203.208.46.146 docs.google.com
    203.208.46.146 docs0.google.com
    203.208.46.146 docs1.google.com
    203.208.46.146 docs2.google.com
    203.208.46.146 docs3.google.com
    203.208.46.146 spreadsheets.google.com
    203.208.46.146 spreadsheets0.google.com
    203.208.46.146 spreadsheets1.google.com
    203.208.46.146 spreadsheets2.google.com
    203.208.46.146 spreadsheets3.google.com

    #Gmail
    203.208.46.146 mail.google.com
    203.208.46.146 chatenabled.mail.google.com #Gmail中Gtalk聊天服务

    #Google 搜索
    203.208.46.146 www.google.com

    #Google preview
    203.208.46.146 www.googlepreview.com

    #Google 翻译
    203.208.46.146 translate.google.com
    203.208.46.146 translate.googleapis.com

    #Google 搜索建议(IE9)
    203.208.46.146 clients5.google.com

    #Google Code
    203.208.46.146 code.google.com

    #Picasa 网络相册
    203.208.46.146 picasaweb.google.com
    203.208.46.146 lh0.ggpht.com
    203.208.46.146 lh1.ggpht.com
    203.208.46.146 lh2.ggpht.com
    203.208.46.146 lh3.ggpht.com
    203.208.46.146 lh4.ggpht.com
    203.208.46.146 lh5.ggpht.com
    203.208.46.146 lh6.ggpht.com
    203.208.46.146 lh7.ggpht.com
    203.208.46.146 lh8.ggpht.com
    203.208.46.146 lh8.ggpht.com
    203.208.46.146 lh9.ggpht.com
    203.208.46.146 lh6.google.com

    #Google 个人资料
    203.208.46.146 profiles.google.com
    203.208.46.146 browsersync.google.com

    #Google+
    203.208.46.146 talkgadget.google.com #Google+中的聊天服务
    203.208.46.146 ssl.gstatic.com
    203.208.46.146 images-pos-opensocial.googleusercontent.com
    203.208.46.146 images1-focus-opensocial.googleusercontent.com
    203.208.46.146 images2-focus-opensocial.googleusercontent.com
    203.208.46.146 images3-focus-opensocial.googleusercontent.com
    203.208.46.146 images4-focus-opensocial.googleusercontent.com
    203.208.46.146 images5-focus-opensocial.googleusercontent.com
    203.208.46.146 images6-focus-opensocial.googleusercontent.com
    203.208.46.146 plus.google.com

    #Download 下载
    203.208.46.146 dl.google.com
    203.208.46.146 dl-ssl.google.com

    #Groups
    203.208.46.146 groups.google.com

    #Google URL Shortener
    203.208.46.146 goo.gl

    #Google App Engine
    203.208.46.146 appengine.google.com

    #Android Developer
    74.125.113.121 developer.android.com

  • 相关阅读:
    使用iframe从网页调起移动端应用
    综合练习:词频统计
    组合数据类型练习
    python 绘制五星红旗
    熟悉常用的Linux操作
    大数据概述
    windowBackground打造闪屏页
    安卓日期选择对话框
    c语言语法分析器
    C语言文法
  • 原文地址:https://www.cnblogs.com/mushui/p/3767469.html
Copyright © 2011-2022 走看看