Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle - Error Could not find method implementation() for arguments [com.android.support:appcompat-v7:26.0.0]

I am trying to open existing android project in android studio and it gradle cannot build the app without the error

Error android studio keeps on throwing

Error:(74, 1) A problem occurred evaluating project ':app'. > Could not find method implementation() for arguments  [com.android.support:appcompat-v7:26.0.0] on object of type  org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. 

My Code in build.gradle Which can help to understand my issue My dependencies

dependencies { compile fileTree(include: ['*.jar'], dir: 'libs')  // google & support implementation "com.android.support:appcompat-v7:$supportVersion" implementation "com.android.support:cardview-v7:$supportVersion" implementation "com.android.support:recyclerview-v7:$supportVersion" implementation "com.android.support:design:$supportVersion" implementation "com.android.support:palette-v7:$supportVersion" implementation "com.android.support:customtabs:$supportVersion" implementation "com.android.support:support-v4:$supportVersion" implementation 'com.google.android.exoplayer:exoplayer:r2.0.4'  // utils implementation 'com.github.bumptech.glide:glide:4.0.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0' implementation 'com.koushikdutta.ion:ion:2.1.7' implementation 'com.github.Commit451:bypasses:1.0.4' implementation 'com.jakewharton:butterknife:8.8.0' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.0' implementation 'com.drewnoakes:metadata-extractor:2.9.1' implementation "com.orhanobut:hawk:2.0.1"  } 

Please help to solve the issue

like image 843
cole Avatar asked Aug 10 '17 13:08

cole


People also ask

What is difference between compile and implementation in Gradle?

Fortunately, the implementation dependency configuration provides the same functionality as compile. You should always use implementation rather than compile for dependencies, as compile is now deprecated or removed in the case of Gradle 7+.

What version of Gradle do I have?

In Android Studio, go to File > Project Structure. Then select the "project" tab on the left. Your Gradle version will be displayed here.


2 Answers

Replace compile with implementation.

compile was recently deprecated and replaced by implementation or api

like image 193
Saurabh Thorat Avatar answered Oct 06 '22 10:10

Saurabh Thorat


Make sure you're adding these dependencies in android/app/build.gradle, not android/build.gradle

like image 26
Sunil Kumar Avatar answered Oct 06 '22 10:10

Sunil Kumar