[英]Could not find com.android.tools.build:gradle:3.5.1
I'm totally new to android studio and came up to this error that says it can not download gradle-3.5.1.pom
and gradle-3.5.1.jar
from google or jcenter repositories.我是 android 工作室的新手,遇到了这个错误,说它无法从谷歌或jcenter存储库下载gradle-3.5.1.pom
和gradle-3.5.1.jar
。 But when I tried downloading them manually it was easy and straight forward though.但是当我尝试手动下载它们时,它虽然简单直接。
Here is the error text:这是错误文本:
ERROR: Could not find com.android.tools.build:gradle:3.5.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.1/gradle-3.5.1.pom
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.1/gradle-3.5.1.jar
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.1/gradle-3.5.1.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.1/gradle-3.5.1.jar
Required by:
project :
Open File
I know that this is going to make me crazy because these gradle stuff always been a problem to all.我知道这会让我发疯,因为这些 gradle 东西一直是所有人的问题。
Make sure you have google()
repo in your project's level build.gradle file.确保您的项目级别 build.gradle 文件中有google()
存储库。 Here's an example:这是一个例子:
build.gradle build.gradle
buildscript {
repositories {
google() // check if you have this
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
}
}
allprojects {
repositories {
google() // and this
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Disable Offline Work in Android studio if you have enabled the checkbox and sync project.如果您已启用复选框并同步项目,请在 Android 工作室中禁用离线工作。 Once the project is synced, you can enable the checkbox and run the app as long as you do not add another dependency manually.项目同步后,只要不手动添加其他依赖项,您就可以启用该复选框并运行应用程序。 It will automatically download the required dependencies.它将自动下载所需的依赖项。 File>Settings>Build>Gradle文件>设置>构建>Gradle
I want a solution to this problem我想要解决这个问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.