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条回答
Anthone
2楼-- · 2019-01-17 00:27

I try to modify the repositories and import the cer to java, but both failed, then I upgrade my jdk version from 1.8.0_66 to 1.8.0_74, gradle build success.

查看更多
【Aperson】
3楼-- · 2019-01-17 00:28

Find and Replace:

jcenter()
maven {
    url "https://maven.google.com"
}

to:

maven {
    url "https://maven.google.com"
}
jcenter()
查看更多
欢心
4楼-- · 2019-01-17 00:30

The solution is in your build.gradle change this block:

allprojects {
  repositories {
    jcenter()
    google()
  }
}

to google in first position :

allprojects {
  repositories {
    google()
    jcenter()
  }
}
查看更多
倾城 Initia
5楼-- · 2019-01-17 00:31

For newer android studio 3.0.0 and gradle update, this needed to be included in project level build.gradle file for android Gradle build tools and related dependencies since Google moved to its own maven repository.

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
查看更多
唯我独甜
6楼-- · 2019-01-17 00:36

I had this issue and it was because I hadn't added an exception for gradle in my firewall (TinyWall).

查看更多
男人必须洒脱
7楼-- · 2019-01-17 00:41

I got this issue solved by switching internet from Wifi to mobile hot-spot. It means this issue occurs due to network issue. I could also see below logs which confirms my understanding,

Connect to jcenter.bintray.com:443 [jcenter.bintray.com/75.126.118.188] failed: Connection timed out: connect

and

Connect to repo1.maven.org:443 [repo1.maven.org/151.101.36.209] failed: Connection timed out: connect

Hope it helps.

查看更多
登录 后发表回答