简体   繁体   English

Android Studio 中的“jcenter.bintray.com:443 failed to respond”错误

[英]“jcenter.bintray.com:443 failed to respond” error in Android Studio

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.我正在尝试在 Android Studio 中构建一个项目,而 Android 的默认构建工具 Gradle 在尝试构建我的项目时总是给我一个错误。 The following is the result of using the "gradlew build" command:以下是使用“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.卸载后,Android Studio 现在可以完美运行。 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!我终于可以开始开发了!

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. Gradle 正在尝试从 https 存储库“ https://jcenter.bintray.com ”下载 jar,但 java 没有客户端证书。 Follow below steps to import client certificates按照以下步骤导入客户端证书

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"

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.卸载后,Android Studio 现在可以完美运行。 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!我终于可以开始开发了!

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.我为我的 AndroidStudio 设置了错误的代理。当我在 gradle 目录中的配置文件 gradle.properties 中删除我的代理时,它会起作用。 Hope this can help you!希望这可以帮助你!

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!注释或删除以上行!

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.properties and 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

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/ .除了将https://jcenter.bintray.com/的证书添加到您的密钥库之外,您还可以检查是否有https://jcenter.bintray.com/的父证书。 If so, you may need to add that certificate as well in the keystore.如果是这样,您可能还需要在密钥库中添加该证书。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 证书 <jcenter.bintray.com> 与任何主题替代名称都不匹配 - Certificate for <jcenter.bintray.com> doesn't match any of the subject alternative names 无法连接到 /127.0.0.1:443 - ANDROID STUDIO - FAILED TO CONNECT TO /127.0.0.1:443 - ANDROID STUDIO 在 Android Studio 中使用 Jcenter 和 gradle - Using Jcenter with gradle in Android studio 错误:无法解析:com.mikepenz:aboutlibraries:6.0.1 in Android Studio - ERROR: Failed to resolve: com.mikepenz:aboutlibraries:6.0.1 in Android Studio Android - 10000 毫秒后无法连接到 settings.crashlytics.com/54.83.49.38(端口 443) - Android - failed to connect to settings.crashlytics.com/54.83.49.38 (port 443) after 10000ms Android studio gradle(错误:无法解析:com.android.support.constraint:constraint-layout-so) - Android studio gradle (Error:Failed to resolve: com.android.support.constraint:constraint-layout-so) 无法解决:Android Studio中的com.android.support:design:26.2.0错误 - Failed to resolve: com.android.support:design:26.2.0 error in Android Studio 将Android库推送到jCenter javadoc错误 - Pushing Android library to jCenter javadoc error 如何修复android studio中的``无法解决:com.android.volly:volly:1.1.1&#39;&#39;错误 - How to fix 'Failed to resolve: com.android.volly:volly:1.1.1'error in android studio Android Studio Start Failed:初始化&#39;com.intellij.util.net.ssl.certificatemanager&#39;时出现致命错误 - Android Studio Start Failed: fatal error initializing 'com.intellij.util.net.ssl.certificatemanager'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM