/Users/Ren/Desktop/RecylerViewBaseAdapter/build.gradle
Error:(6, 0) Gradle DSL method not found: 'google()'
Possible causes:
The project 'RecylerViewBaseAdapter' may be using a version of Gradle that does not contain the method.
Gradle settings
The build file may be missing a Gradle plugin.
Apply Gradle plugin
发布于 2017-10-04 03:05:51
如果您使用的是Android studio 2.3.3,那么尝试在您的项目级别gradle中添加以下代码
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
这对我很有效。
你也可以使用google(),但是你需要Gradle 4.x+,Android Studio 3.x+,Gradle plugin 3.x+
发布于 2018-06-11 08:35:41
看起来您使用的Gradle版本低于4.1
解决方案1:
更改gradle-wrapper.properties
中的分发地址,如下所示:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip
要找到gradle-wrapper.properties
文件,请在Android Studio中按ctrl + shift + N
并输入gradle-wrapper
更改依赖关系,如下所示:
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
解决方案2:
在您的repositories{...}
块中使用以下代码,而不是google()
maven {
url 'https://maven.google.com'
// An alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
发布于 2018-03-23 16:56:54
用这个修改你的项目级gradle文件
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
https://stackoverflow.com/questions/45781489
复制相似问题