Android Studio / Intellij, Gradle Error:Cause: peer not authenticated

24,459

Solution 1

Change your repositories syntax in build.gradle as following. See following question.

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

Solution 2

yeah I experienced exactly same situation It is not easy, but now I'm clear

I changed the build.gradle located in project forlder, not in app folder

I changed as below

repositories {
    jcenter 
    { 
        url 'http://jcenter.bintray.com' 
    } 
}

instead of

repositories {
    jacenter()
}

Solution 3

you should import the certificate:

First of all download the certificate (.cer) from this url, Help is here

Copy it to the path JDK_HOME/jre/lib/security

Then with command prompt targeted to above location, run the following command:

keytool -import -alias git -file <cert_file_name_you_exported.cer> -keystore cacerts -storepass changeit

Type yes if it prompts for approval, after that open the desired IDEA and have fun :)

If this doesn't help, try importing the certificate to JRE/lib/security/cacerts, It's totally depend on the build path of the IDEA you are using

Solution 4

I've fixed this issue by adding the following to me build.gradle:

repositories{
   maven {    
       url 'http://repo1.maven.org/maven2';
         }
 } 

Once done, try syncing and rebuilding your project. Hope this was helpful.

Share:
24,459
NathanielB
Author by

NathanielB

I'm an amateur programmer of 8 years, currently studying android development.

Updated on July 09, 2022

Comments

  • NathanielB
    NathanielB almost 2 years

    Having a fight with IntelliJ at the moment. The darn thing won't download Gradle 2.1

    I have an Android project hosted on GitHub, which I have cloned to my laptop. I have got working SSL certificates, I know this as I can download SDK software from google using SSL, and I can also download Gradle 1.12. The message I have received from IntelliJ is the rather infamous Error:Cause: peer not authenticated error.

    From the terminal running IntelliJ I get this:

        * What went wrong:
    A problem occurred configuring root project 'SomeAndroidProject'.
    > Could not resolve all dependencies for configuration ':classpath'.
       > Could not resolve com.android.tools.build:gradle:0.13.0.
         Required by:
             :SomeAndroidProject:unspecified
          > Could not HEAD 'https://jcenter.bintray.com/com/android/tools/build/gradle/0.13.0/gradle-0.13.0.pom'.
             > peer not authenticated
    

    I have search far and wide across the internet, with no avail. Please help me wise SO guru's!

  • Atilla Ozgur
    Atilla Ozgur over 9 years
    Your java version may be different in your desktop computer. See linked question.
  • Paul
    Paul about 8 years
    After struggling for couple of hours this was the onlu solution that works. Just a note: the name of the certificate in my case was "ESETSSLFilterCA.crt" - extension crt and not cer
  • Sam
    Sam almost 7 years
    This should be changed in project gradle file if you updating the gradle version not in the app folder