使用okhttp 出现 java.net.ConnectException: Failed to connect to /192.168.1.121:8888
compile 'com.squareup.okhttp3:okhttp:3.3.0' //okttp依赖
项目使用okhttp3.3.0,结果运行时出现如上错误,经过排查发现是由于retrofit的原因,把如下三个依赖删除就行了
初步分析,应该是okhttp和retrofit出现冲突了,至于具体怎么回事,就不清楚了。
dependencies {
....
// retrofit
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
...
}