Android Studio 3.0 金丝雀 5 - 错误 :Unable to load class 'org.gradle.api.internal.component.Usage'

标签 android android-studio gradle

我已经通读了所有与此相关的现有堆栈问题,他们的解决方案对我没有帮助。

  • 自从所有 AS 更新到 2.3 以上后,这个问题就很明显了。
  • 创建一个新项目就OK了
  • 我试图从“新项目”复制所有值,但它仍然存在

错误:

Error:Unable to load class 'org.gradle.api.internal.component.Usage'. Possible causes for this unexpected error include:

  • 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.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

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/

相关文章:

android - 暂时禁用 EditText 字段时出现问题

java - 大小为 1 的 CursorIndexOutOfBoundException : Index 1 requested,

android-studio - 如何在AMD Ryzen(Android Studio)上使用Android Emulator?

spring - 如何在Spring Boot中创建一个可执行jar?

java - 将图钉放置在 fragment 中的 map fragment 上

Android Camera Preview 在 google glass 上显示不正确?

android - Flutter 随机崩溃并删除 Flutter 文件

java - 毕加索图片在 android 中加载缓慢,为什么?

java - 错误:java. lang.RuntimeException : java. lang.RuntimeException : com. android.builder.dexing.DexArchiveMergerException:无法合并dex

android - Android Studio构建失败字段 'signature'的值不正确