我在我的项目中使用Retrofit-1.6.0
+ okhttp-2.0.0-RC1
.当我运行项目时,我得到了错误.
java.lang.RuntimeException: Retrofit detected an unsupported OkHttp on the classpath. To use OkHttp with this version of Retrofit, you'll need: 1. com.squareup.okhttp:okhttp:1.6.0 (or newer) 2. com.squareup.okhttp:okhttp-urlconnection:1.6.0 (or newer) Note that OkHttp 2.0.0+ is supported!
有谁知道如何解决这个问题?
即使使用OkHTTP 2,您也需要导入额外的urlConnection
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
好吧,square已经在github上发布了2.0 RC2,但是没有在maven上发布:
https://github.com/square/okhttp
但你仍然需要okhttp-urlconnection(RC1),它只在maven上:
http://mvnrepository.com/artifact/com.squareup.okhttp
并且不要忘记okhttp 2.0现在依赖于okio:
https://github.com/square/okio