java Android Studio 中的“jcenter.bintray.com:443 无法响应”错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39323145/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"jcenter.bintray.com:443 failed to respond" error in Android Studio
提问by Hyman Scott
I am trying to build a project in Android Studio, and Android's default build tool, Gradle, ALWAYS gives me an error when it attempts to build my project. The following is the result of using the "gradlew build" command:
我正在尝试在 Android Studio 中构建一个项目,而 Android 的默认构建工具 Gradle 在尝试构建我的项目时总是给我一个错误。以下是使用“gradlew build”命令的结果:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'MyFirstApp'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.1.3.
Required by:
:MyFirstApp:unspecified
> Could not resolve com.android.tools.build:gradle:2.1.3.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/
gradle/2.1.3/gradle-2.1.3.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle
/2.1.3/gradle-2.1.3.pom'.
> jcenter.bintray.com:443 failed to respond
I have tried using an http proxy, vpn, turning off my firewall, deleting the cache in the .gradle foler, and even completely reinstalling Android Studio, but nothing seems to be working.
我曾尝试使用 http 代理、vpn、关闭防火墙、删除 .gradle 文件中的缓存,甚至完全重新安装 Android Studio,但似乎没有任何效果。
I am new to Android development, so any information is appreciated!
我是 Android 开发的新手,因此感谢您提供任何信息!
Here is the error when the proxy is implemented:
这是实现代理时的错误:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'MyFirstApp'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.1.3.
Required by:
:MyFirstApp:unspecified
> Could not resolve com.android.tools.build:gradle:2.1.3.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/
gradle/2.1.3/gradle-2.1.3.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle
/2.1.3/gradle-2.1.3.pom'.
> Remote host closed connection during handshake
I was able to add the HTTPS certificate to the keystore for jcenter.bintray.com, but now I am getting a JVM error whenever I start android studio: Android Studio JVM Error
我能够将 HTTPS 证书添加到 jcenter.bintray.com 的密钥库中,但是现在每当我启动 android studio 时都会收到 JVM 错误: Android Studio JVM Error
I have checked my environment variables, tried changing them, and the error persists. My java environment variables are set as follows:
我检查了我的环境变量,尝试更改它们,但错误仍然存在。我的java环境变量设置如下:
User Variables:
PATH: %JAVA_HOME%\bin
JAVA_HOME: C:\Program Files\Java\jdk1.8.0_101
System Variables:
CLASSPATH: C:\Program Files\Java\jre1.8.0_101
JAVA_HOME: C:\Program Files\Java\jdk1.8.0_101\bin
EDIT: After setting my Java home path in the gradle.properties file, I am now getting a different error when I attempt to build my project.
编辑:在 gradle.properties 文件中设置我的 Java 主路径后,我现在在尝试构建我的项目时遇到不同的错误。
Downloading https://services.gradle.org/distributions/gradle-2.14.1-all.zip
Exception in thread "main" java.net.SocketException: Software caused connection abort: recv failed
EDIT: I just wanted to let everyone know that I figured it out! Apparently my parents put some insanely powerful parental control software on my computer a few years ago and I forgot it was there. After uninstalling, Android Studio now works flawlessly. The software basically blocked all unknown traffic coming in and out of most of the ports. Anyway, thank you to everyone for the help. I can finally start developing!
编辑:我只是想让大家知道我想通了!显然,几年前我的父母在我的电脑上安装了一些非常强大的家长控制软件,我忘记了它在那里。卸载后,Android Studio 现在可以完美运行。该软件基本上阻止了进出大多数端口的所有未知流量。不管怎样,谢谢大家的帮助。我终于可以开始开发了!
采纳答案by Hyman Scott
I just wanted to let everyone know that I figured it out! Apparently my parents put some insanely powerful parental control software on my computer a few years ago and I forgot it was there. After uninstalling, Android Studio now works flawlessly. The software basically blocked all unknown traffic coming in and out of most of the ports. Anyway, thank you to everyone for the help. I can finally start developing!
我只是想让大家知道我想通了!显然,几年前我的父母在我的电脑上安装了一些非常强大的家长控制软件,我忘记了它在那里。卸载后,Android Studio 现在可以完美运行。该软件基本上阻止了进出大多数端口的所有未知流量。不管怎样,谢谢大家的帮助。我终于可以开始开发了!
回答by ravthiru
Try setting both http and https as shown below
尝试设置 http 和 https,如下所示
gradlew -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=8080 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8144
EDIT1 :
编辑1:
Gradle is trying to download jars from https repo "https://jcenter.bintray.com" but java does not have client certificates. Follow below steps to import client certificates
Gradle 正在尝试从 https 存储库“ https://jcenter.bintray.com”下载 jar,但 java 没有客户端证书。按照以下步骤导入客户端证书
Step 1 : Download Client Certificate
第 1 步:下载客户端证书
a) Open https://jcenter.bintray.com URL in the browser (i.e firefox)
b) Click on the lock icon right to the URL bar
c) Server URL is shown , click to get right arrow and then on "more information"
d) Pop-up is opened to view the certificate of the Server.
e) click on the "View Certificate", In "details" table export to a file CERT_FILE_NAME.crt
Step 2 : Import the client certificate to JDK which Gradle is using
第 2 步:将客户端证书导入 Gradle 使用的 JDK
keytool -import -noprompt -trustcacerts -alias "clojars.org" -file C:\CERT_FILE_NAME.crt -keystore C:\java\jre\lib\security\cacerts -storepass "changeit"
回答by Cyrus
I met this problem because i was in China. i set a wrong proxy for my AndroidStudio.it works when i delete my proxy in config file gradle.properties located in gradle directory. Hope this can help you!
我遇到这个问题是因为我在 CN 。我为我的 AndroidStudio 设置了错误的代理。当我在 gradle 目录中的配置文件 gradle.properties 中删除我的代理时,它会起作用。希望这可以帮到你!
systemProp.https.proxyPort=10808
systemProp.https.proxyPort=10808
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=10808
systemProp.http.proxyPort=10808
Comment or delete above lines!
注释或删除以上行!
回答by Ted
If you behind a proxy, you must set proxy for Gradle separately because Gradle doesn't use AndroidStudio's proxy settings:
如果你在代理后面,你必须单独为 Gradle 设置代理,因为 Gradle 不使用 AndroidStudio 的代理设置:
open gradle.propertiesand add the following lines, change ip addr to your proxy's ip.
打开gradle.properties并添加以下几行,将 ip addr 更改为您的代理的 ip。
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyPort=7070
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=7070
回答by SaAn
Other than adding the certificate of https://jcenter.bintray.com/to your key store, can you also check if there is a parent certificate for https://jcenter.bintray.com/. If so, you may need to add that certificate as well in the keystore.
除了将https://jcenter.bintray.com/的证书添加到您的密钥库之外,您还可以检查是否有https://jcenter.bintray.com/的父证书。如果是这样,您可能还需要在密钥库中添加该证书。