无法加载类'org.gradle.api.internal.component.Usage'。

26

升级到了最新的Android Studio稳定版本和Gradle 4.2后,我无法完成我的项目或任何操作,并且仍然出现这些问题。尽管我创建了一个新项目,但还是无法操作。

有什么建议吗?

错误:无法加载类'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'
1个回答

67

谢谢,我已经解决了这个问题!这个问题是因为我使用的Gradle版本是3.4.1,它与插件'com.novoda:bintray-release:0.4.0'不兼容,当我将其升级到0.5.0时就可以正常工作了。答案帮助我解决了这个问题!希望能帮到你!


2
现在最新的Novoda版本是0.8.0。我使用classpath 'com.novoda:bintray-release:0.8.0'修复了我的Gradle。希望这也能帮助其他人。 :) - Bhoomika Patel
哇,这个问题让我感到困惑。非常感谢。 - D2TheC
最新可用版本可以在此处找到:https://bintray.com/novoda/maven/bintray-release - Gayan Weerakutti
谢谢,它帮助解决了那个花费了很多时间的问题。 - ॐ Rakesh Kumar

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接