Issue
I am unable to run my app in the android emulator. It was working previously, but something broke it.
Error message:
A problem occurred evaluating root project 'android'.
> Could not find method implementation() for arguments [com.google.android.material:material:1.1.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I am running gradle 3.2.1. Here is my build.gradle file's buildscript:
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
google()
jcenter()
maven {
url 'https://dl.google.com/dl/android/maven2'
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:3.2.1'
implementation "com.google.android.material:material:1.1.0"
}
}
Solution
That is the top-level gradle file.
Move this line to the dependencies section of the build.gradle
file inside the app folder, and also update to latest version:
implementation 'com.google.android.material:material:1.1.0-beta01'
For more info, see here: Why are there two build.gradle files in an Android Studio project?
Answered By - Daniel Nugent
Answer Checked By - Clifford M. (JavaFixing Volunteer)