[英]Gradle project sync failed in android studio 3.1
my gradle.build contains
我的gradle.build包含
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and upon syncing project with gradle files is showing error as connection refused:connect . 并且在与gradle文件同步项目时由于连接被拒绝而显示错误:connect。 There is a problem with Apply script build.gradle Not able to resolve dependencies of classpath
Apply脚本build.gradle存在问题无法解决类路径的依赖关系
Log file showing the below error 日志文件显示以下错误
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.1.0/gradle-3.1.0.pom'.
at org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:96)
Try using invalidate caches and restart in File Menu. 尝试使用无效缓存,然后在“文件”菜单中重新启动。 Most of the time it works when studio have a new update.
在Studio进行新更新时,大部分时间都可以使用。
Goto "File > Project Structure > SDK Location" menu and Check "Use embedded JDK(recommended)". 转到“文件>项目结构> SDK位置”菜单,然后选中“使用嵌入式JDK(推荐)”。 It may be your JDK version problem.
这可能是您的JDK版本问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.