So I am implementing some dependencies in the Gradle file and when I try to sync it, I get
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.
The Gradle file looks like this:
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
}
I have tried to change implementation
to compile
and even changing the Gradle version in the classpath line, with no success.
How do I fix this?
Note: I am using Pop_OS! 20.04 LTS if that matters
CodePudding user response:
Your dependencies should go into the build.gradle
of your module/app not in the build.gradle
of your project:
The build.gradle
of your app should looks something like this:
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'
}
The only thing that should go into the build.gradle
of your project is the classpath.