Unable to load class 'org.gradle.api.publication.maven.internal.MavenPomMetaInfoProvider'

Viewed 19051

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.

5 Answers

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.

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'

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'

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.

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

Related