当我尝试构建项目时出现错误:
不能HEAD' http://maven.google.com/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.pom' 引起:javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException:PKIX路径构建失败: sun.security.provider.certpath.SunCertPathBuilderException:无法找到所请求目标的有效证书路径
这是我的build.gradle
:
buildscript {
repositories {
maven { url 'http://mvnrepository.com/repos/central' }
maven { url 'http://repo1.maven.org/maven2' }
maven { url 'http://dl.google.com/dl/android/maven2' }
maven { url 'http://maven.google.com'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
allprojects {
repositories {
maven { url 'http://mvnrepository.com/repos/central' }
maven { url 'http://repo1.maven.org/maven2' }
maven { url 'http://dl.google.com/dl/android/maven2' }
maven { url 'http://maven.google.com'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我必须使用http连接。不是https,因为在将所需的证书安装到%JAVA_HOME%
之后,在Android证书设置中,我仍然得到SSLHandshakeException
。