39

When I update gradle in android studio I found this type error Unable to load class 'org.gradle.api.publication.maven.internal.MavenPomMetaInfoProvider'. his is an unexpected error. Please file a bug containing the idea.log file.

ZABIH ULLAH
  • 538
  • 1
  • 4
  • 7

6 Answers6

26

In my case, the issue was in this line:

apply plugin: 'com.github.dcendents.android-maven'

Before now, I was using Gradle plugin 4.2.2, and today I updated it to 7.0.0 and got the same error as you. I solved the issue by removing this line from my build.gradle.

Аlex
  • 361
  • 2
  • 5
  • 12
    after removing this i get: Could not find method install() for arguments [...] on project [...] – mpountou Aug 03 '21 at 13:25
  • 3
    Downgrade your gradle version to 6.7.1. It works for me. – Satheesh Aug 23 '21 at 08:00
  • you will also need to remove this line from build.gradle if you have it. id "com.github.dcendents.android-maven" version "2.0" from plugins section – puneet yadav Oct 07 '21 at 14:41
  • I don't have these lines at all, but like @Alex, I upgraded `gradle plugin version` to 7.0.1, 7.0.2... so on, and this error does not go away. My problem resolved on `gradle wrapper version` 6.7.1 and trying `gradle plugin version` 4.2.2 is final solution. @Satheesh, you can post your suggestion as answer, and I will upvote. – Abhinav Saxena Oct 09 '21 at 18:00
  • @mpountou you probably have an `install { }` block somewhere in a gradle file that you need to remove after upgrading to gradle 7+. – Adam Johns Jan 18 '23 at 20:11
5

I experienced this issue when using a library pushed on jitpack.io The docs on jitpack.io mention to include this in the root build.gradle file

allprojects {
    repositories {
        ....
        maven { url 'https://jitpack.io' }
    }
}

Where as with the latest updates this has changed. Android Studio no longer includes a allprojects block in the root build.gradle file.

To make this work you now need to include maven { url 'https://jitpack.io' } in settings.gradle file instead.

Here is how my settings.gradle looks like:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url "https://jitpack.io" }
    }
}

rootProject.name = "<App Name>"
include ':app'
Dharman
  • 30,962
  • 25
  • 85
  • 135
Saksham Pruthi
  • 394
  • 1
  • 8
4

DATE UPDATED EVERY TIME I GOT UPVOTE AS I KNOW IT IS STILL VALID

DATE: 04/11/2021 (4th of Nov 2021)

after receiving that error when updated to gradle 7.0.0, I tried @Alex solution but, it didn't work for me,

I removed two lines and it's working now.

apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'android-maven'
Moustafa EL-Saghier
  • 1,721
  • 1
  • 13
  • 43
  • I don't have these lines at all, but like @Alex, I upgraded `gradle plugin version` to 7.0.1, 7.0.2... so on, and this error does not go away. My problem resolved on `gradle wrapper version` 6.7.1 and trying `gradle plugin version` 4.2.2 is final solution. – Abhinav Saxena Oct 09 '21 at 17:59
4

Check if other modules have this plugin:

apply plugin: 'com.github.dcendents.android-maven'

In my case it was in countrycodepicker

I removed it from there, and it worked.

Raj Kumar
  • 402
  • 4
  • 9
1

I faced the same issue when I migrate the project to the latest version in July 2023.

I was experience this issue in countrycodepicker.

In the file:

../../countrycodepicker/build.gradle

on line:

apply plugin: 'com.github.dcendents.android-maven'

Solution (Working in July 2023):

After removing the line, the component is now functioning properly.

apply plugin: 'com.github.dcendents.android-maven'
ankushlokhande
  • 870
  • 5
  • 20
0

Downgrade your gradle version to 6.7.1. It works for me.

Satheesh
  • 71
  • 1
  • 8
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 12 '21 at 10:47
  • Downgrading is never a correct answer. Downgrading leads to nothing. Some time in future you have to upgrade. What would you do? – Evgenii Vorobei Jul 09 '23 at 09:29