解決ADT及SDK Manager 下載失敗的問題
由於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