Android Studio 2.3.3错误Gradle

当我安装Android Studio 2.3.3时,我已经开发了projet mobile,我运行项目我有这个错误:

出了什么问题:配置根项目'android'时出现问题 . 无法解析配置':classpath'的所有依赖项 . 无法解决com.android.tools.build:gradle:2.2.3 . 要求:项目:无法解析com.android.tools.build:gradle:2.2.3 . 无法获得资源'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.p om' .

> Could not resolve com.android.tools.build:gradle:2.2.3.
     > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom'

.

无法获取'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom' . 连接到jcenter.bintray.com:443 [jcenter.bintray.com/159.122.18.156]失败:连接超时:连接

提前致谢

回答(3)

2 years ago

TLDR,我认为这可能是因为网络问题,但您也可以使用jcenter()和mavenCentral()中存在的版本(如 2.3.0 ) .

首先,你在jcenter()和mavenCentral()中有不同的版本 .

https://jcenter.bintray.com/com/android/tools/build/gradle/

2.2.0/
2.2.1/
2.2.2/
2.2.3/
2.3.0/
2.3.1/
2.3.2/
2.3.3/

https://repo1.maven.org/maven2/com/android/tools/build/gradle/

2.0.0/                                            2016-04-07 17:59         -      
2.1.0/                                            2016-04-26 23:02         -      
2.1.2/                                            2016-06-06 18:06         -      
2.1.3/                                            2016-08-24 05:01         -      
2.3.0/                                            2017-03-06 22:09         -

其次,我认为您的错误可能是由于网络问题 .

wget https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom 对我很有用

$ wget https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
--2017-07-18 08:00:23--  https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
Resolving jcenter.bintray.com... 75.126.118.188
Connecting to jcenter.bintray.com|75.126.118.188|:443... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Server: nginx
  Date: Tue, 18 Jul 2017 12:00:23 GMT
  Content-Type: application/octet-stream
  Content-Length: 1284
  Connection: keep-alive
  Content-Disposition: attachment; filename="gradle-2.2.3.pom"
  Last-Modified: Tue, 06 Dec 2016 20:27:26 GMT
  Cache-Control: max-age=30, must-revalidate
  Accept-Ranges: none
  ETag: 7c167b79cda55769e0fe6a438f826f203609f1e2db792a93f2b6fae9d71b2259
  X-Checksum-Sha1: 88b4934c958cfe74ff5559c1a33707a562af59d2
  X-Checksum-Sha2: 7c167b79cda55769e0fe6a438f826f203609f1e2db792a93f2b6fae9d71b2259
Length: 1284 (1.3K) [application/octet-stream]
Saving to: ‘gradle-2.2.3.pom’

gradle-2.2.3.pom                                          100%[====================================================================================================================================>]   1.25K  --.-KB/s    in 0s      

2017-07-18 08:00:23 (18.0 MB/s) - ‘gradle-2.2.3.pom’ saved [1284/1284]

无法获取'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom' . 连接到jcenter.bintray.com:443 [jcenter.bintray.com/159.122.18.156]失败:连接超时:连接

但是, ping jcenter.bintray.com:443 [jcenter.bintray.com/159.122.18.156] 对我来说似乎也失败了

$ ping 159.122.18.156
PING 159.122.18.156 (159.122.18.156): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
^C
--- 159.122.18.156 ping statistics ---
4 packets transmitted, 0 packets received, 100.0% packet loss

2 years ago

我有相同的pb,因为我们在这里有一个代理,我在文件>设置中配置我不明白为什么Gradle继续告诉我有连接超时 . 我已经成功解决了在gradle.properties中添加HTTPS代理系统道具的问题

systemProp.https.proxyHost=<my proxy hostname>
 systemProp.https.proxyPort=<my proxy port>

我的gradle.properties只包含http.proxyHost / Port道具......

2 years ago

在你的项目级别build.gradle文件检查jcenter()是否存在,如果没有尝试上面的代码

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}