Fix Gradle 'Could not find method implementation()' error
You're using Gradle 3.x or lower, but 'implementation' requires Gradle 4.0+. Update your Gradle wrapper and check the Android plugin version.
Quick answer
Update your Gradle wrapper to 4.0 or higher and your Android Gradle plugin to 3.0+.
Why this happens
You wrote implementation 'some-library' in your module-level build.gradle, but that syntax only works with Gradle 4.0 and Android Gradle plugin 3.0. If you're on Gradle 3.x (common with older projects or some CI setups) the method doesn't exist. The culprit here is almost always a stale Gradle wrapper – the gradle-wrapper.properties file points to an old version.
This error pops up when you migrate from the old compile configuration to implementation. Don't bother checking other build files first – the wrapper is what controls the Gradle version used at build time.
Fix steps
- Check your current Gradle version
Opengradle/wrapper/gradle-wrapper.properties. Look for the linedistributionUrl. If it saysgradle-3.xor lower, that's your problem. - Update the Gradle wrapper
In your terminal or Android Studio terminal, run:
This regenerates the wrapper files and sets the version. For Android projects, stick with 7.6 or 8.0 – don't jump to bleeding edge 8.5+ unless you want more breakage../gradlew wrapper --gradle-version 7.6 - Update the Android Gradle plugin
In your rootbuild.gradle, change theclasspathline for the Android Gradle plugin:
Use 7.4.2 for stable compatibility. Check the Android plugin version compatibility table to match your Gradle version.dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
} - Sync and build
Click "Sync Now" in Android Studio, or run./gradlew clean assembleDebug. The error should be gone.
Alternative fixes if that doesn't work
- Mix of 'compile' and 'implementation' in same file
If you're stuck on Gradle 3.x (e.g., legacy CI), replaceimplementationback tocompile. Yes, it's deprecated, but it works. Example:compile 'com.squareup.okhttp3:okhttp:4.9.0' - Wrong build.gradle file
Make sure you edited the module-levelbuild.gradle, not the root one. Root usesclasspath, notimplementation. I've seen this mistake more times than I count. - Corrupted Gradle cache
Delete~/.gradle/caches/and the.gradlefolder in your project. Rebuild. Sometimes a corrupted cache causes Gradle to ignore the wrapper version.
Prevention tip
Before you start any Android project, run ./gradlew wrapper --gradle-version 7.6 as part of your initial setup. Also, pin your Gradle version in a CI config file (like .gitlab-ci.yml or Jenkinsfile) so builds don't silently fall back to an old system Gradle installation. Keep a copy of the plugin compatibility table bookmarked.
One more thing: don't mix the new and old configuration names in the same project. Pick implementation, api, and compileOnly for new projects. If you're maintaining an old project, do a complete migration in one commit – partial upgrades cause these exact errors.
Was this solution helpful?