当我安装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]失败:连接超时 :连接
提前致谢
答案 0 :(得分:2)
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
答案 1 :(得分:1)
我有相同的pb,因为我们在这里有代理,我在File>中配置了设置我不明白为什么Gradle一直告诉我连接超时。我已设法解决它在gradle.properties中添加HTTPS代理系统道具
systemProp.https.proxyHost=<my proxy hostname>
systemProp.https.proxyPort=<my proxy port>
我的gradle.properties只包含http.proxyHost / Port props ...
答案 2 :(得分:1)
就我而言,注释掉gradle.properties中的代理设置即可解决问题。
#systemProp.https.proxyPort=8580
#systemProp.http.proxyHost=127.0.0.1
#systemProp.https.proxyHost=127.0.0.1
#systemProp.http.proxyPort=8580
答案 3 :(得分:0)
在你的项目级别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
}
}