Android studio error:Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin 'com.github.dcendents.android-maven'

I used Android Studio,to import github project for practicing,when I tried to build project,error occured,

> Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin 'com.github.dcendents.android-maven'.

> Caused by: org.gradle.api.plugins.PluginInstantiationException: Could not create plugin of type 'AndroidMavenPlugin'.

> Caused by: org.gradle.internal.instantiation.ClassGenerationException: Could not generate a decorated class for type AndroidMavenPlugin

This is project build.gradle:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.2.1'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

this is my gradle-wrapper.properties

#Fri Jun 07 10:47:48 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

I searched for method to resolve it,many answers were about grald-plugin not matched gradle,but I cound not find how to really solve it.

That plugin is 6 years old, making it compatible with Gradle 4.6 with that release. After that it was archived as the Android Gradle Plugin for the same functionality. So it is quite likely, that it simply is not compatible with Gradle 8.2.

Thanks,it worked.But then when I go on,I download jdk1.8 to resolv below error:

The project uses Gradle 4.6 which is incompatible with Java 11 or newer
and it worked,after that, a new error occured like below:

Could not find com.android.tools.build:gradle:4.6.
Searched in the following locations:
    https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.6/gradle-4.6.pom
    https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.6/gradle-4.6.jar
    https://jcenter.bintray.com/com/android/tools/build/gradle/4.6/gradle-4.6.pom
    https://jcenter.bintray.com/com/android/tools/build/gradle/4.6/gradle-4.6.jar
    https://mirrors.cloud.tencent.com/repository/maven/com/android/tools/build/gradle/4.6/gradle-4.6.pom
    https://mirrors.cloud.tencent.com/repository/maven/com/android/tools/build/gradle/4.6/gradle-4.6.jar
Required by:
    project :
Add google Maven repository and sync project
Open File

and I trie modified my root build.gradle,added maven{…} like below code:

buildscript {
    repositories {
        google()
        jcenter()
        **maven{url 'https://mirrors.cloud.tencent.com/repository/maven/'}**
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.6'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

but it still could not work well,do you know the reason.

I also have a question,why Gradle 4.6 is compatible with this project,I tried download 3.0 version and failed,could you tell me where I can find the compatible version in the web.

com.android.tools.build:gradle is not the Gradle version. It is the Android Gradle Plugin that unfortunately called their artifact gradle, but it has nothing to with the Gradle version.

Thaks,I will try it.