Could not resolve all dependencies for configurati

2019-01-17 00:17发布

I cant seem to get build tools for the latest gradle at all. I suspect its something to do with proxy setting for gradle. I have had a good look online but still cant seem to find a solution. I use gradle 2.1.

I created gradle.properties file in my /home/user/.gradle folder with these setting.

systemProp.http.proxyHost=proxy systemProp.http.proxyPort=80 systemProp.http.proxyUser=myusername systemProp.http.proxyPassword=password

systemProp.https.proxyHost=proxy systemProp.https.proxyPort=80 systemProp.https.proxyUser=myusername systemProp.https.proxyPassword=password

Here is my global build.gradle

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.13.0'
        classpath fileTree(dir: 'build-libs', include: '*.jar')
    }
}


allprojects {
    repositories {
        mavenCentral()
    }
}

And here is the error i get when running grawlew Could not HEAD 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/0.13.0/gradle-0.13.0.pom'. peer not authenticated

What am i missing? that maven link opens fine in a browser.

10条回答
Deceive 欺骗
2楼-- · 2019-01-17 00:42

late but it worked for me:
change your dns setting by going Network and sharing center.
In left pane choose change adapter setting
-right click on your network connection
-properties
-select ipv4
-properties
- now in dns server setting:-
-choose the option use the following dns server addresses
and use google dns server 8.8.8.8 as preferred dns server and 8.8.4.4 as alternate dns server.

it will solve your problem.

查看更多
趁早两清
3楼-- · 2019-01-17 00:47

Right im not sure if it will work for others but worked for me.

I changed proxyPort to 8080 and used jcenter instead of Maven. But i had to apply expeption to use HTTP instead of HTTPS. This is what i have in my gradle.build for build script and allprojects

buildscript {
repositories {
    jcenter {
        url "http://jcenter.bintray.com/"
    }
  }
}

allprojects {
repositories {
    jcenter {
        url "http://jcenter.bintray.com/"
    }
  }
}

UPDATE: 06/08

I have recently updated Gradle and plugin version and had some problems. It was complaining about plugin com.android.application

I did some digging around and changed

 jcenter {
    url "http://jcenter.bintray.com/"
}

to

    repositories {
    maven { url 'http://repo1.maven.org/maven2' }
}
查看更多
Ridiculous、
4楼-- · 2019-01-17 00:47

you should have gradle.properties file defined for the build with proxy settings so that gradle knows how to use http connection

# This file contains the basics for Maven Version control and will be used by the Artifactory Release management
# These settings are for the root project and all sub-projects in this application
releaseVersion=1.0.0-SNAPSHOT
releaseGroup=com.xx.xx.xx
artifactory_user=
artifactory_password=
artifactory_contextUrl=https://artifactory.xxxx.com/artifactory/
systemProp.http.proxyHost=proxy.xxx.com
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=proxy.xxx.com
systemProp.https.proxyPort=8080
systemProp.http.nonProxyHosts=*.xxx.com|localhost|*.int.targoe.com
org.gradle.java.home=C:\\Program Files (x86)\\Java\\jdk1.8.0_121
查看更多
干净又极端
5楼-- · 2019-01-17 00:48

I'm using Gradle plugin 3.0.1 and saw this error. Not sure what caused this but the solution that works for me is to stop the running Gradle daemon by ./gradlew --stop.

查看更多
登录 后发表回答