当我运行此项目时,未找到 Gradle DSL 方法:发生了“implementation()”错误。我点击了给定的链接,但它不起作用!我无法解决这个问题。你能帮我吗?
这里是 构建.gradle
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
implementation 'com.android.support:design:28.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
当我单击链接按钮时,出现错误消息
最佳答案
您正在将依赖项添加到不正确的 gradle 文件中。
所有项目依赖项(此处实现“com.android.support:design:28.0.0”
)都应放入您应用的build.gradle
文件中。
仔细看看你的项目结构,那里肯定有2个build.gradle文件,将此依赖项添加到另一个gradle文件中。
关于java - 我该如何解决这个错误? (错误: Gradle DSL method not found: 'implementation()' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57753727/