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

前端 未结 23 1798
离开以前
离开以前 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 04:55
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.1'   
    }
    

    I change classpath com.android.tools.build:gradle:1.1.3' to com.android.tools.build:gradle:1.0.0

    0 讨论(0)
  • 2020-12-03 04:56

    answer share from here https://stackoverflow.com/a/37962441/4030497 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)

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

    Changing my build.gradle to shown below worked.

    buildscript {
        repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
    }
    }
    
    allprojects {
        repositories {
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
    0 讨论(0)
  • 2020-12-03 05:01

    DO NOT change your package source to http instead of https. Stop using these workarounds and fix the root cause.

    Do you want to have a driveby exploit in your app? Because that's how you get a driveby exploit in your app!

    The source of this problem Certificate Authority keystore. Somehow dpkg seems to try to build the Java keystore (/etc/ssl/certs/java/cacerts) before it actually installs Java, which the the tool to build the store requires. The result is an empty store:

    To fix this, properly build the keystore with all trusted CA certificates.

    Run this with sudo:

    sudo rm /etc/ssl/certs/java/cacerts
    sudo /var/lib/dpkg/info/ca-certificates-java.postinst configure
    

    You should see a long list of added certificates (*.pem) and finally a “done”.

    Re-sync the project using gradle, and all will download. Don't forget to turn off the http override if you've set it!

    Source: https://justus.berlin/2015/01/connection-problems-with-ssltls-peers-in-java-on-ubuntu-server-14-12-with-fix/

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

    It's a dumb answer, but what fixed this for me was restarting Android Studio.

    I was using Charles Proxy off and on, I suspect that had something to do with the cause of the error. Closed the proxy and restarted android studio, and it worked. Figured I would post because sometimes the answer is so simple we forget to even try it.

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

    This was the solution that worked for me. Posting here in case it helps someone.

    Gradle version was not correct in project build.gradle file.

    I had

    classpath 'com.android.tools.build:gradle:1.0.0'
    

    but this needed to be

    classpath 'com.android.tools.build:gradle:2.1.0'
    

    Note:
    This should be updated to the newest version of gradle tools which can be found here Android Studio also recommends the latest plugin version.

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