3

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"

    }
}
Kelli
  • 127
  • 1
  • 2
  • 8

2 Answers2

11

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?

Daniel Nugent
  • 43,104
  • 15
  • 109
  • 137
0

Write that line in build.gradle(Module:yourAppName.app)file

TECH_WIZ
  • 1
  • 2
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 15 '21 at 07:12