Unable to load class 'org.gradle.api.internal.component.Usage'.

一、 问题描述:

Unable to load class 'org.gradle.api.internal.component.Usage'.
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)</li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)</li><li>Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

在这里插入图片描述

二、解决办法

这是因为插件兼容问题致使的错误,若是有com.novoda:bintray-release请把版本修改成0.5.0。java

PS : 感谢weixin_41101173的提示,对于大于AndroidStudio3.14版本的,请改成0.8.0android

async之后 出现新的问题web

Cause: com.novoda.gradle.release.AndroidLibrary$LibraryUsage.getDependencyConstraints()Ljava/util/Set;

在这里插入图片描述

从网上百度了一下,好多博客写的是Gradle版本太高,修改为4.4(本来为4.6)api

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

进行修改,再次编译。出现新的问题:app

Minimum supported Gradle version is 4.6. Current version is 4.4.

Please fix the project's Gradle settings.
Fix Gradle wrapper and re-import project
Gradle settings

在这里插入图片描述

那问题就来了,要求Minimum必须为4.6,可是那个问题又要求Gradle版本为4.4,咱们该怎么办,那就修改project的引用gradle:我将build:gradle版本修改成3.1.0 (原为3.2.1)async

classpath 'com.android.tools.build:gradle:3.1.0’svg

dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath 'com.novoda:bintray-release:0.8.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

再次编译,Build Success
在这里插入图片描述gradle

以上是我遇到的问题,但愿这篇文章能帮到遇到一样问题的你!ui