Android Studio 常见 Connect to 127

作者: WindsOfDanzon | 来源:发表于2019-02-20 11:15 被阅读792次

    下载资源做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中

    相关文章

      网友评论

        本文标题:Android Studio 常见 Connect to 127

        本文链接:https://www.haomeiwen.com/subject/albcyqtx.html