因此,我在Gradle文件中实现了一些依赖项,当我尝试同步它时,我得到
Build file '/home/qwirrr/AndroidStudioProjects/ClockIn/build.gradle' line: 9
A problem occurred evaluating root project 'ClockIn'.
> Could not find method implementation() for arguments [androidx.fragment:fragment:1.3.6] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Gradle文件如下所示:
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
implementation 'androidx.fragment:fragment:1.3.6'
implementation 'com.google.android.material:material:1.0.0'
classpath "com.android.tools.build:gradle:7.0.3"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我曾尝试将implementation
更改为compile
,甚至在类路径行中更改Gradle版本,但都没有成功。
我该如何解决这个问题?
注意:我正在使用Pop_OS!20.04 LTS,如果有关系的话
发布于 2021-11-10 03:11:17
您的依赖项应该放在模块/应用程序的build.gradle
中,而不是项目的build.gradle
中:
你的应用程序的build.gradle
应该如下所示:
plugins {
id 'com.android.application'
...
}
android {
...
}
dependencies {
//all your dependencies goes here
implementation 'androidx.fragment:fragment:1.3.6'
implementation 'com.google.android.material:material:1.0.0'
}
您项目的build.gradle
中唯一应该包含的内容是类路径。
https://stackoverflow.com/questions/69902868
复制相似问题