java – OkHttpClient在更新Retrofit到Retrofit 2之后坏了
从改造到改造2更新后出现此错误.
我在应用程序中使用的libs版本是: compile 'com.squareup.okhttp3:okhttp:3.2.0' compile 'com.squareup.okhttp3:okhttp-urlconnection:3.2.0' compile 'com.squareup:otto:1.3.7' compile 'com.google.code.gson:gson:2.6.2' compile 'com.squareup.retrofit2:retrofit:2.1.0' compile 'com.squareup.retrofit2:converter-gson:2.1.0' compile 'com.squareup.okhttp3:logging-interceptor:3.2.0' 不确定是否是因为okhttp版本,但我尝试了2.3.0和3.4.0之间的几个不同的版本,但没有一个工作. 有任何想法吗?提前致谢. 解决方法
和你有同样的问题.
首先,扔出去: compile 'com.squareup.okhttp3:okhttp:3.2.0' 改造有okhttp3因为它的依赖性所以它不需要.而且,当你检查here Retrofit 2.1.0取决于okhttp 3.3.0时,可能会有冲突.请记住,最终的依赖版本是您在gradle文件中编写的版本.如果您不编写它,Gradle会自动解析它并获取正确的版本. 还有一个更新版本的Logging Interceptor和urlconnection: compile 'com.squareup.okhttp3:logging-interceptor:3.4.1' compile 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1' 希望能解决问题. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |