1. 程式人生 > >android studio 如何解決SDK Manerger更新顯示連線失敗

android studio 如何解決SDK Manerger更新顯示連線失敗

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

並且提示升級時提示 Connection failed. Please check your network connection and try again

第一種方法

修改Proxy

使用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,這個在官方開發文件裡也有介紹。今天自己遇到的就直接利用這種方法就解決了。

第二種方法:

修改安裝目錄下bin\studio.exe.vmoptions檔案,如D:\Android\android-studio\bin\studio64.exe.vmoptions

新增內容:

-Djava.net.preferIPv4Stack=true
-Didea.updates.url=http://dl.google.com/android/studio/patches/updates.xml
-Didea.patches.url=http://dl.google.com/android/studio/patches/

重新啟動..就可以線上更新了.(如果你安裝的是32位就是

D:\Android\android-studio\bin\studio.exe.vmoptions)

解決Android SDK Manager列表錯誤,或者無法更新下載的問題:

新增內容:
C:\Windows\System32\drivers\etc

74.125.237.1 dl-ssl.google.com 

然後再重新啟動Android Studio。