Android Studio Gradle build failed. Error:Cause: peer not authenticated

前端 未结 23 1800
离开以前
离开以前 2020-12-03 04:54

I have already created one project and gradle sync worked successfully.

When I try to create another project it fails and gives the error message that



        
相关标签:
23条回答
  • 2020-12-03 05:17
    distributionUrl=http://services.gradle.org/distributions/gradle-2.1-all.zip
    

    keep the http://

    0 讨论(0)
  • 2020-12-03 05:20

    Usually this error happens when you're under a company proxy. My solution on MAC was this:

    1. Identify the Certificate is being used by your https connections

    2. Open Key Chain Tools (cmd+space key chain)

    3. Identify the certificate found up and export it to certificate.cer file
    4. Open the terminal and navigate to your JAVA JRE security folder:

      cd /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/security

    5. Import the certificate with the following command:

      sudo keytool -import -alias somealias -file /PATH_TO_EXPORTED_CERTIFICATE/certificate.cer -keystore cacerts -storepass changeit

    That is done. Open Android Studio and it will fix the gradle build.

    0 讨论(0)
  • 2020-12-03 05:21

    In case this helps someone, I had the same issue and even though I set the proxy through the studio settings ( which adds the values of systemProp.http.proxyHost and systemProp.http.proxyHost to gradle.properties), https proxy was not set, so I added this in gradle.properties

    systemProp.https.proxyHost = <your proxy host>
    systemProp.https.proxyPort = <your proxy port>
    

    and problem solved!

    0 讨论(0)
  • 2020-12-03 05:22

    This error says that you're trying to connect using HTTPS protocol, but your client unable to validate server's certificate - usually because it is self signed.

    Connect to https://jcenter.bintray.com with your browser, and check the certificate chain. The root certificate should be issued by GeoTrust Global CA. If it's not the case, your Internet Provider or your employer perform MITM to your HTTPS connections.

    If you trust them, the simple workaround will be to add those self-signed certificates into JDK's cacerts keystore. Examples for how to do that: Windows; Linux/Mac.

    0 讨论(0)
  • 2020-12-03 05:22

    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.

    0 讨论(0)
提交回复
热议问题