下載資源做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
相信大家看見這個問題,本能反應(yīng)就是有本地代理導(dǎo)致 AS 獲取資源的時候遠(yuǎn)端服務(wù)器訪問不到。不出意外,都會想到需要刪除項目根目錄 gradle.properties 內(nèi)的代理配置,來解決這個問題:
systemProp.https.proxyPort=1080
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080
但是,如果這樣還沒有解決的話
那就需要我們?nèi)?gradle 默認(rèn)全局配置里去刪除掉代理配置了,對應(yīng)位置
Windows 在:C:\Users\Administrator.gradle下的gradle.properties中
Mac 在:/Users/.{你的用戶目錄}/.gradle下的gradle.properties中