Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
java.lang.NoClassDefFoundError:解析:Lokio/ForwardingTimeout失败_Java_Android_Retrofit_Okio_Okhttp - Fatal编程技术网

java.lang.NoClassDefFoundError:解析:Lokio/ForwardingTimeout失败

java.lang.NoClassDefFoundError:解析:Lokio/ForwardingTimeout失败,java,android,retrofit,okio,okhttp,Java,Android,Retrofit,Okio,Okhttp,我使用一个android项目作为库,它使用以下作为jar添加的库 okhttp-2.2.0.jar okhttp-urlconnection-2.2.0.jar okio-1.2.0.jar retrofit-1.9.0.jar 在我的主要项目中,我使用以下库 compile 'com.squareup.retrofit2:retrofit:2.1.0' compile 'com.squareup.retrofit2:converter-gson:2.1.0' compile 'com.squ

我使用一个android项目作为库,它使用以下作为jar添加的库

okhttp-2.2.0.jar
okhttp-urlconnection-2.2.0.jar
okio-1.2.0.jar
retrofit-1.9.0.jar
在我的主要项目中,我使用以下库

compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.google.code.gson:gson:2.7'
还有其他一些图书馆,但经过一些研究,我发现这些都是问题的根源

该应用运行良好,但当我试图使用改型来使用任何web服务时,由于以下错误而崩溃

java.lang.NoClassDefFoundError:解析:Lokio/ForwardingTimeout失败

在我的应用程序级渐变文件中,我添加了

multiDexEnabled true
我还尝试添加

configurations{
    all*.exclude module: 'okhttp-2.2.0'
    all*.exclude module: 'okio'
}
我试着像下面这样添加对gradle的依赖

compile ('com.squareup.retrofit2:retrofit:2.1.0') {
    exclude group: 'okio'
}
compile ('com.squareup.retrofit2:converter-gson:2.1.0') {
    exclude group: 'okio'
}

所有这些都不起作用,我的项目在添加库项目之前运行良好。任何帮助都将不胜感激

对于测试用例,注释lib调用并设置
compile'com.google.code.gson:gson:2.6.2'compile'com.squareup.Refught2:Refught2:2.0.2'compile'com.squareup.Refught2:converter-gson:2.0.2'
谢谢您的回复,我试过了
compile'com.squareup.okhttp3:okhttp:3.5.0'
。我想这是一个版本不匹配的问题,尝试过但没有结果对于测试用例,注释库调用和设置
compile'com.google.code.gson:gson:2.6.2'compile'com.squareup.infrant2:infrant2.0.2'compile'com.squareup.infrant2:converter-gson:2.0.2'
感谢您的回复,我试过了,但没有成功编译'com.squareup.okhttp3:okhttp:3.5.0'。我想这是一个版本不匹配的问题,尝试过但没有结果