构建失败,出现异常:Peer未经过身份验证

时间:2016-08-09 09:37:23

标签: android android-studio android-gradle build.gradle

清洁&构建,出现以下错误

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'MyProject'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.google.gms:google-services:1.3.0-beta1.
     Required by:
         :MyProject:unspecified
      > Could not resolve com.google.gms:google-services:1.3.0-beta1.
         > Could not get resource 'https://jcenter.bintray.com/com/google/gms/google-services/1.3.0-beta1/google-services-1.3.0-beta1.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/google/gms/google-services/1.3.0-beta1/google-services-1.3.0-beta1.pom'.
               > peer not authenticated
      > Could not resolve com.google.gms:google-services:1.3.0-beta1.
         > Could not get resource 'https://repo1.maven.org/maven2/com/google/gms/google-services/1.3.0-beta1/google-services-1.3.0-beta1.pom'.
            > Could not GET 'https://repo1.maven.org/maven2/com/google/gms/google-services/1.3.0-beta1/google-services-1.3.0-beta1.pom'.
               > peer not authenticated

我还在C:\ Program Files \ Java \ jre7 \ lib \ security中添加了安全证书,但仍然不知道如何修复它,请帮帮我

的build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {

        classpath 'com.android.tools.build:gradle:2.1.2'
        classpath 'com.google.gms:google-services:1.3.0-beta1'
        repositories { mavenCentral() }
    }
}

allprojects {
    repositories {
          maven {
            url 'https://jitpack.io'
        }

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

由于

1 个答案:

答案 0 :(得分:0)

尝试将build.gradle更改为:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
        classpath 'com.google.gms:google-services:1.3.0-beta1'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

或强制gradle使用http:

buildscript {
    repositories {
        maven { url "http://jcenter.bintray.com" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
        classpath 'com.google.gms:google-services:1.3.0-beta1'
    }
}

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