您的位置:首页 > 理论基础 > 计算机网络

java.lang.NoClassDefFoundError: Failed resolution of: Lio/bugtags/agent/instrumentation/okhttp3/OkHt

2017-11-16 17:09 204 查看
在使用Retrofit2.0的时候碰见这个问题:

java.lang.NoClassDefFoundError: Failed resolution of: Lio/bugtags/agent/instrumentation/okhttp3/OkHttp3Instrumentation;


找了一半天最后修改了一下Gradle的版本就解决了,要注意Gradle和Gradle插件的版本要对应上

Gradle:gradle-wrapper.properties文件中的gradle;

Gradle插件:project的build.gralde中的classpath对应的gradle;

1、Gradle插件设置:

我项目的build.gradle,注意不是module的build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}


2、Gradle设置

#Thu Nov 16 14:49:15 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip


我之前使用的Gradle版本是3.3修改为2.14.1后就可以了,原因我还不知道,有路过的大神请给答案,谢了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐