我已经通读了所有与此相关的现有堆栈问题,他们的解决方案对我没有帮助。
- 自从所有 AS 更新到 2.3 以上后,这个问题就很明显了。
- 创建一个新项目就OK了
- 我试图从“新项目”复制所有值,但它仍然存在
错误:
Error:Unable to load class 'org.gradle.api.internal.component.Usage'. Possible causes for this unexpected error include:
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
- Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
- 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)
- 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.
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
项目build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha5'
classpath "io.realm:realm-gradle-plugin:0.89.1"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
设置 Gradle
Use default gradle wrapper
模块设置
Compile Sdk Version: API 26
Build Tools Version: 26.0.0
我相信这些都是最新的。 我已经尝试使缓存无效并重新启动/重新启动机器
最佳答案
我尝试了以上所有关于删除缓存的建议,但没有任何效果。最后,问题出在插件 com.novoda:bintray-release:0.4.0
上。当我将它升级到 0.5.0
时,它起作用了。
我会仔细看看你的 gradle 插件!
关于Android Studio 3.0 金丝雀 5 - 错误 :Unable to load class 'org.gradle.api.internal.component.Usage' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45006029/