11

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!

NathanielB
  • 145
  • 1
  • 1
  • 10
  • Oh, and it's the same with http address - I have only just tried https recently. I'm not going to lie - I haven't a clue how to use or configure gradle. docs give you a 400 page pdf - it's almost larger then the Java language specification itself! ^_^ – NathanielB Nov 29 '14 at 19:23

9 Answers9

26

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

repositories {
    jcenter {
        url "http://jcenter.bintray.com/"
    }
}
Community
  • 1
  • 1
Atilla Ozgur
  • 14,339
  • 3
  • 49
  • 69
5

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

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

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

2

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

Hana Bzh
  • 2,212
  • 3
  • 18
  • 38
  • 1
    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 – Paul Feb 29 '16 at 12:59
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()
}
Felix Shin
  • 84
  • 6
1

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.

SKallmann
  • 170
  • 1
  • 5
0

When I updated to Android Studio 1.0 I found that I need to update to use 1.0.0 version of gradle.

Inside of the build.gradle file I had

  dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0-rc2'

I changed it to remove the "-rc2"

  dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
Brian S
  • 3,096
  • 37
  • 55
0

"Error:Cause: peer not authenticated."

As this occurs I using Ubuntu: When I changed version on android studio 2.0 9 preview beta 1.

How do I fix my gradle.

Simply created a new project in android studio and then went in and saw build.grandle version gradle in my case:  

 dependencies {
         classpath 'com.android.tools.build:gradle:2.0.0-beta1'
     }

and replace in my project.

I hope it helps others.

Levi Saturnino
  • 221
  • 3
  • 4
0

Like BzH :

This is a Java SSL connection error I solved on Github here.

You need to add the appropriate SSL certificate to the java keystore for java accept the connection.

Work fine :)

Pierre C.
  • 1,591
  • 2
  • 16
  • 29
0

in case when there are some problems with internet try to add a line

54.231.14.232 s3.amazonaws.com

to your /etc/hosts (..\Windows\System32\drivers\etc\hosts)

swiftBoy
  • 35,607
  • 26
  • 136
  • 135
Serg
  • 41
  • 3