Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 387
ZABIH ULLAH Avatar asked Aug 01 '21 09:08

ZABIH ULLAH


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

like image 91
Аlex Avatar answered Nov 15 '22 09:11

Аlex


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'
like image 27
Saksham Pruthi Avatar answered Nov 15 '22 09:11

Saksham Pruthi


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'
like image 3
Moustafa EL-Saghier Avatar answered Nov 15 '22 10:11

Moustafa EL-Saghier