由于google及其组建服务经常无法连线更新,给Android及相关开发学习带来了不便,而在PC上尤其linux下,翻墙并不是很容易,一些资源常常不可用,因此会经常遇到:
使用SDK Manager更新时出现问题Failed to fetch URL https://dl-ssl.google.com/android/repository/repository-6.xml, reason: Connection to https://dl-ssl.google.com refusedFailed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-1.xml, reason: Connection to http://dl-ssl.google.com refusedFailed 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
我们可以通过修改hosts文件的方法解决这类问题:
1. linux下打开编辑hosts文件: sudo gedit /etc/hosts :
windows下打开编辑:C:\WINDOWS\system32\drivers\etc\hosts
打开hosts文件后添加google重常用地址:
202.152.192.181 dl.google.com
202.152.192.181 dl.l.google.com
202.152.192.181 dl-ssl.google.com
202.152.192.181 developer.android.com
当然,这些google的地址经常更新,最新地址可参考:
http://www.awolau.com/hosts/google-hosts.html