Android Studio 常見 Connect to 127.0.0.1:1080 [/127.0.0.1] failed: Connection refused: connect 問題處理

 

下載資源做sync操作的時候,有時會遇到這種問題:

> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.github.dcendents:android-maven-gradle-plugin:1.3.
     Required by:
         project :
      > Could not resolve com.github.dcendents:android-maven-gradle-plugin:1.3.
         > Could not get resource 'https://jcenter.bintray.com/com/github/dcendents/android-maven-gradle-plugin/1.3/android-maven-gradle-plugin-1.3.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/github/dcendents/android-maven-gradle-plugin/1.3/android-maven-gradle-plugin-1.3.pom'.
               > Connect to 127.0.0.1:1080 [/127.0.0.1] failed: Connection refused: connect

相信大家看見這個問題,本能反應就是有本地代理導致 AS 獲取資源的時候遠端服務器訪問不到。不出意外,都會想到需要刪除項目根目錄 gradle.properties 內的代理配置,來解決這個問題:

systemProp.https.proxyPort=1080
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080

但是,如果這樣還沒有解決的話

那就需要我們去 gradle 默認全局配置裏去刪除掉代理配置了,對應位置
Windows 在:C:\Users\Administrator.gradle下的gradle.properties中
Mac 在:/Users/.{你的用戶目錄}/.gradle下的gradle.properties中

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章