AmmAr Yasser
AmmAr Yasser

Reputation: 391

Could not find method mavenCentral()

I think I miss something about mavenCentral() thanks a lot

that's error message :

Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method mavenCentral() for arguments [] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

I also add to buildscript

 maven {
            url 'https://maven.google.com/'
        }

but same error again.

enter image description here

Upvotes: 1

Views: 3074

Answers (2)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 364928

The mavenCentral() is a repo (the central Maven repository), not a dependency.

Move the mavenCentral() in the buildscript/repositories block.

buildscript{
  repositories {
    google()
    jcenter()
    mavenCentral()  
  }
  ...
}

Upvotes: 0

Mohamed Hamza
Mohamed Hamza

Reputation: 311

Place it in repositories block, not dependencies:

repositories {
    google()
    jcenter()
    mavenCentral()  //here
}

Upvotes: 1

Related Questions