Gradle 9 stops at jcenter() because the method no longer exists
Could not find method jcenter() for arguments [] on repository containerShort answer
Gradle 9.0.0 removed the jcenter() repository method, so any build script that still calls it fails the moment Gradle evaluates it. Replace each jcenter() with mavenCentral(), including in the pluginManagement block of settings.gradle. If you cannot edit the scripts yet, pin the wrapper to a Gradle 8.x release.
Fix it fast
1Find out which cause you have
List every file that still calls jcenter(). Check the settings file, the root build file, every module and any script you apply with apply from.
grep -rn "jcenter" --include=*.gradle --include=*.kts --include=*.properties .2Match what you see, then jump to its fix
- 1
The error points at a line in build.gradle (root or module) inside repositories { }A project or buildscript block still calls jcenter()Fix - 2
The error names settings.gradle (or settings.gradle.kts) rather than a build filejcenter() is in the plugin repositories of settings.gradleFix - 3
gradle/wrapper/gradle-wrapper.properties names a 9.x distribution and the build worked on 8.xYou are not ready to edit the scripts: the wrapper moved to Gradle 9Fix
- 1
What does the error look like?
Could not find method jcenter() for arguments [] on repository container
Cause 1 of 3
A project or buildscript block still calls jcenter()
1Check
Gradle 9.0.0 removed the jcenter() repository API. JCenter itself was redirected to Maven Central in August 2024, so nothing is lost by dropping it.
grep -rn "jcenter()" --include=build.gradle --include=build.gradle.kts .2Fix
Replace jcenter() with mavenCentral(). Keep google() on top if the project is an Android app.
repositories {
google()
mavenCentral()
}3Verify
Run any task. The configuration phase must pass without the method error.
./gradlew helpConfirmed by docs.gradle.org
Cause 2 of 3
jcenter() is in the plugin repositories of settings.gradle
1Check
Plugins are resolved from the repositories under pluginManagement in the settings file, which are separate from the project repositories. An old project can carry jcenter() there.
grep -n -B2 -A6 "pluginManagement" settings.gradle settings.gradle.kts 2>/dev/null2Fix
Edit the pluginManagement block so it lists Maven Central and the Gradle Plugin Portal, and add google() for Android plugins.
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}3Verify
Run a task again and confirm the plugin resolves.
./gradlew helpConfirmed by docs.gradle.org
Cause 3 of 3
You are not ready to edit the scripts: the wrapper moved to Gradle 9
1Check
The wrapper file decides which Gradle runs the build. Upgrading it (by hand or by an IDE prompt) is what brings in the removal.
grep distributionUrl gradle/wrapper/gradle-wrapper.properties2Fix
Point the wrapper back at a Gradle 8.x release for now (8.14.3 is an example version), then migrate the scripts and upgrade again. Run the task twice so the jar and scripts are updated too.
./gradlew wrapper --gradle-version 8.14.3
./gradlew wrapper --gradle-version 8.14.33Verify
Print the version Gradle reports.
./gradlew --versionConfirmed by docs.gradle.org
How do I stop it coming back?
- Search the whole repository, including included builds and shared script plugins, for jcenter before you raise the Gradle version.
- Read the upgrade notes for the next major Gradle version before changing distributionUrl.
- Keep repositories in one place (settings file) so a removed method needs one edit.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Mobile apps
Gradle build fails because jcenter() cannot be reached
the Gradle build fails when it is unable to resolve a dependency from any repository
JCenter was made read-only, then retired and redirected to Maven Central.
3 causes, each with a fixMobile apps
adb cannot start because something already holds its port
adb start-server failed
The adb server must bind local TCP port 5037, and every adb client talks to it there.
2 causes, each with a fixMobile apps
The phone shows as unauthorized and Android Studio will not run the app
adb devices lists the phone but Android Studio cannot deploy to it
An unauthorized phone means it has not trusted this computer's RSA key.
3 causes, each with a fixMobile apps
Android Studio cannot pair the phone over Wi-Fi
The Pair devices over Wi-Fi dialog lists no device
Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.
4 causes, each with a fixMobile apps
adb cannot connect to its daemon or start the server
* daemon started successfully *
The adb server is a background process on your computer that listens on TCP port 5037.
2 causes, each with a fixMobile apps
adb prints 'server version doesn't match this client; killing...'
adb server version doesn't match this client; killing...
adb runs a background server, and every adb command is a client.
3 causes, each with a fix