当我在eclipse中导入gradle项目时,它给了我这个错误。
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'test'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve de.richsource.gradle.plugins:gwt-gradle-plugin:0.3.
Required by:
:test:unspecified
> Could not GET 'https://github.com/steffenschaefer/gwt-gradle-plugin/raw/maven-repo/de/richsource/gradle/plugins/gwt-gradle-plugin/0.3/gwt-gradle-plugin-0.3.pom'.
> peer not authenticated
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
我通过代理连接使用互联网。如果这是问题,在eclipse中指定代理设置的位置。在常规 - >网络连接中,代理设置已经存在
请帮忙。
如果你得到这样的任何其他错误:
Could not GET 'https://some_server.com/some/path/some.pom'.
> peer not authenticated
然后你需要导入证书:
JDK_HOME/jre/lib/security
文件夹中JDK_HOME/jre/lib/security
文件夹keytool -import -alias <the short name of the server> -file <cert_file_name_you_exported.cer> -keystore cacerts -storepass changeit
它将提示您导入证书,键入yes并按Enter键。
然后重启你的eclipse并尝试构建项目。
我有一个奇怪的例子,我不得不改变jcenter和maven的顺序来摆脱错误
不工作
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
maven { url "https://jitpack.io" }
}
}
工作
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
maven { url "https://jitpack.io" }
}
}
如果有其他人遇到此问题,关闭我的卡巴斯基反病毒软件对我来说就是这个伎俩。
答案#2:在两个负标记后提供正确的修复
对顶级build.gradle文件进行此更改。
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
//jcenter()
jcenter {
url "http://jcenter.bintray.com/" <=THIS IS THE LINE THAT MAKES THE DIFFERENCE
}
}
}
allprojects {
repositories {
//jcenter()
jcenter {
url "http://jcenter.bintray.com/" <=THIS IS THE LINE THAT MAKES THE DIFFERENCE
}
}
}
答案#1(虽然不接受这个想保留这个)
如果您看到“peer not authenticated errors,则并不一定意味着应用程序没有持有有效证书。这也可能意味着防火墙,负载均衡器或Web服务器正在重置连接。尝试(重新)启动应用Administator
特权。
在Windows上:
在Linux上:
sudo "app execution script name"
在build.gradle中将存储库更改为以下内容
repositories {
maven {
url "http://repo1.maven.org/maven2"
}
}
按照上面的答案中的建议导入证书后,编辑gradle.properties文件并插入以下行(请记住您的代理设置):
HTTPS:
systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
HTTP:
systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
从java7升级到java8对我来说是个窍门。
我尝试修改存储库并将cer导入java,但两者都失败了,然后我将jdk版本从1.8.0_66升级到1.8.0_74,gradle构建成功。
我正在使用android studio 1.51和Linux(Ubuntu 14.04 LTS)并得到相同的错误消息:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not resolve com.github.PhilJay:MPAndroidChart:v2.1.6.
Required by:
dbtraining-dbtrainingandroidapp-517de26197d8:app:unspecified
> Could not resolve com.github.PhilJay:MPAndroidChart:v2.1.6.
> Could not get resource 'https://jitpack.io/com/github/PhilJay/MPAndroidChart/v2.1.6/MPAndroidChart-v2.1.6.pom'.
> Could not GET 'https://jitpack.io/com/github/PhilJay/MPAndroidChart/v2.1.6/MPAndroidChart-v2.1.6.pom'.
> peer not authenticated
我试图移动maven { url "https://jitpack.io" }
,将其设置为http而不是https,激活“自动接受不受信任的证书”,手动添加ssl证书...但仍然没有运气。
解决方案是从OpenJDK 7切换到Oracle JDK 8:
jdk1.8.0_101
/opt/
(nautilus热键:CTRL + L)并创建一个新文件夹“Oracle_Java”。也许这需要root访问权限,所以从sudo nautilus
开放nautilusjdk1.8.0_101
复制到/opt/Oracle_Java
按照https://wiki.ubuntuusers.de/Java/Installation/Oracle_Java/Java_8/#Java-8-JDK的说明操作:不要忘记用您的版本替换路径中的版本占位符sudo update-alternatives --install "/usr/bin/java" "java" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/java" 1 sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/javac" 1 sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/javaws" 1 sudo update-alternatives --install "/usr/bin/jar" "jar" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/jar" 1 sudo update-alternatives --set "java" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/java" sudo update-alternatives --set "javac" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/javac" sudo update-alternatives --set "javaws" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/javaws" sudo update-alternatives --set "jar" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/jar"
java -version
检查终端。project structure
窗口并转到SDK
Location
。在这里,您可以设置JDK的路径,例如/opt/Oracle_Java/jdk1.8.0_101
而已! :)
我有这个错误,因为VPN代理问题而发生这种情况。我禁用了我的VPN客户端,一切运行正常。我用过这个命令(在Mac上):
sudo /opt/cisco/anyconnect/bin/acwebsecagent -disablesvc -websecurity
升级到最新版本的gradle为我修复了这个问题。
distributionUrl
中的gradle-wrapper.properties
以使用最新版本。gradleVersion
中的build.gradle
以匹配该版本。