【问题标题】:Unable to load class 'org.gradle.api.internal.component.Usage'无法加载类“org.gradle.api.internal.component.Usage”
【发布时间】:2018-05-24 04:40:47
【问题描述】:

在使用 Gradle 4.2 升级到最新的稳定版 Android Studio 后,我无法执行我的项目或其他任何事情,并且仍然遇到这些问题。即使我创建了一个新项目,但无法做到。

有什么建议吗?

错误:无法加载类 'org.gradle.api.internal.component.Usage'

此意外错误的可能原因包括:

  • Gradle 的依赖缓存可能已损坏(这有时会在网络连接超时后发生。) 重新下载依赖并同步项目(需要网络)
  • Gradle 构建过程(守护程序)的状态可能已损坏。停止所有 Gradle 守护程序可能会解决此问题。 停止 Gradle 构建过程(需要重新启动)
  • 您的项目可能正在使用与项目中的其他插件或项目请求的 Gradle 版本不兼容的第三方插件。
在 Gradle 进程损坏的情况下,也可以尝试关闭 IDE,然后杀死所有 Java 进程。

我的 gradle 的构建:

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-    core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation project(':libs:searchview')
implementation project(':libs:AndroidImageSlider')

implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:customtabs:27.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:recyclerview-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'

implementation 'com.github.stfalcon:frescoimageviewer:0.5.0'
implementation 'com.facebook.fresco:fresco:1.3.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'jp.wasabeef:picasso-transformations:2.1.2'
implementation 'de.hdodenhof:circleimageview:2.2.0'

implementation 'org.jsoup:jsoup:1.9.2'
implementation ('com.squareup.retrofit2:converter-gson:2.0.2'){
    exclude group: 'org.apache.commons', module: 'commons-io'
}
implementation ('com.squareup.retrofit2:retrofit-converters:2.0.2'){
    exclude group: 'org.apache.commons', module: 'commons-io'
}
implementation 'com.squareup.okhttp3:logging-interceptor:3.2.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'

implementation 'com.klinkerapps:drag-dismiss-activity:1.5.0'

implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0'

implementation 'com.roughike:bottom-bar:2.3.1'
implementation 'pub.devrel:easypermissions:1.1.0'

implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-crash:11.8.0'

implementation('com.sangcomz:FishBun:0.7.7@aar') {
    transitive = true
}

testImplementation 'junit:junit:4.12'

}

apply plugin: 'com.google.gms.google-services'

【问题讨论】:

    标签: java android android-studio


    【解决方案1】:

    谢谢,我已经解决了这个问题!出现这个问题是因为我使用的gradle的版本是3.4.1,和插件'com.novoda:bintray-release:0.4.0'的gradle版本不兼容,当我将它升级到0.5.0时,它可以工作。答案是帮助我解决那个问题! Wish可以帮到你!

    【讨论】:

    • 目前最新的 novoda 版本是 0.8.0 。我用 classpath 'com.novoda:bintray-release:0.8.0' 修复了我的 gradle 希望这也可以帮助其他人。 :)
    • 哇,这让我很困惑。非常感谢
    • 可以在这里找到最新的可用版本:bintray.com/novoda/maven/bintray-release
    • 谢谢,它帮助解决了这个需要花费大量时间的问题。
    猜你喜欢
    • 2017-12-13
    • 2018-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-18
    • 2016-11-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多