问题描述
google()
jcenter()
maven {
url 'https://maven.google.com'
}
但即使现在我也无法同步gradle
解决方法
当我打开一个过时的学习项目时遇到了这个错误。
我采取了以下步骤来解决我的问题:
(可选)4.如果像我在示例中一样打开了一个较旧的项目,请不要忘记在build.gradle(Module:app)中将compileSdkVersion,minSdkVersion和targetSdkVersion设置为已安装的SDK版本。文件。
在我的示例中,this is my updated build.gradle(Project: "Project_name") file.
,我的错误是我在想
classpath 'com.android.tools.build:gradle:4.2.0-alpha13'
在build.gradle中,与
相同distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
在gradle-wrapper.properties中的所以请转到项目结构中的项目标签,然后在列表框中设置android gradle插件版本和gradle版本,然后再次同步
,在项目的build.gradle中,修改如下:
buildscript {
repositories {
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} // <-- add
//jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
allprojects {
repositories {
google()
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} // <-- add
//jcenter()
}
}
希望对您有所帮助