最近公司有个需求,需要将我们的app的一部分(直播间)功能抽取出来,做一个SDK。
先把部分通用的功能移过来是没毛病的。在操作网络这块的时候,报出了这个异常(rxjava + retrofit)!
先google一下。找到了这篇相同问题的 坑爹的博客

博主给出的解决方案:
法一:加上compile'com.squareup.okhttp3:logging-interceptor:3.4.1'
我也试着把自己项目里 retrofit 的 add interceptor 的代码注释,确实就没这个报错了,那么加上这个 interceptor 肯定就可以了咯!
就这样我以为问题就要解决了。。
按照博主的步骤操作了一遍还是不行,回头看看这篇博客的评论

内心是崩溃的。
继续 google,在 stackoverflow 上看到了这个回答

法二:把 retrofit 的版本从2.1.0改成2.0.2后,这个报错消失了!!
等等,是方法一 + 方法二起的作用还是单独的方法二起的作用?
把 compile'com.squareup.okhttp3:logging-interceptor:3.4.1' 注释掉以后,并没有报错。
我又找了下retorfit的Issues retrofit Issues 1088,有人指出是版本问题。
注意:在gradle里修改retrofit的版本的时候,最好clean!
网友评论