Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Gradle 9 stops at jcenter() because the method no longer exists

ErrorCould not find method jcenter() for arguments [] on repository container

Short 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.

  • Applies to Gradle 9.x, Android Gradle Plugin 9.x
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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 .
  2. 2Match what you see, then jump to its fix

    1. 1The error points at a line in build.gradle (root or module) inside repositories { }A project or buildscript block still calls jcenter()Fix
    2. 2The error names settings.gradle (or settings.gradle.kts) rather than a build filejcenter() is in the plugin repositories of settings.gradleFix
    3. 3gradle/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

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 help

Confirmed by docs.gradle.org

Did this fix it?

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/null

2Fix

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 help

Confirmed by docs.gradle.org

Did this fix it?

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.properties

2Fix

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.3

3Verify

Print the version Gradle reports.

./gradlew --version

Confirmed by docs.gradle.org

Did this fix it?

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

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 fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.