我安装了Andorid Studio,并且第一次启动一个新项目。
在编译时出现以下错误:“连接被拒绝:连接”
我尝试设置代理,也尝试使用本地gradle,但这没有帮助。
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'MyApplication2'.
[...]
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'.
[...]
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.3.1.
Required by:
project :
[...]
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.3.1.
[...]
Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
[...]e
Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
[...]
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to xx.xxx.xx.xx:8080 [/xx.xxx.xx.xx] failed: Connection refused: connect
[...]
Caused by: java.net.ConnectException: Connection refused: connect
[...]
最佳答案
问题可能是由于代理人造成的,
或者,下载Gradle发行版,并在 gradle-wrapper.properties 中提供该zip文件的路径。distributionUrl=../../../tools/gradle-4.10.1-all.zip
关于android - Android Studio Gradle连接被拒绝:连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55632290/