1、 问题描述:
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.
2、解决办法
这是由于插件兼容问题导致的错误,如果有com.novoda:bintray-release请把版本修改为0.5.0。
PS : 感谢weixin_41101173的提示,对于大于AndroidStudio3.14版本的,请改为0.8.0
async以后 出现新的问题
Cause: com.novoda.gradle.release.AndroidLibrary$LibraryUsage.getDependencyConstraints()Ljava/util/Set;
从网上百度了一下,好多博客写的是Gradle版本过高,修改成4.4(原本为4.6)
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
进行修改,再次编译。出现新的问题:
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)
classpath 'com.android.tools.build:gradle:3.1.0’
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
以上是我遇到的问题,希望这篇文章能帮到遇到同样问题的你!