ExceptionInInitializerError in Okhttp.Builder w/ Multidex & Kitkat

♀尐吖头ヾ 提交于 2019-12-05 08:11:16

show app dependencies tree

+--- com.ogaclejapan.smarttablayout:utils-v4:2.0.0
+--- com.duolingo.open:rtl-viewpager:1.0.3
+--- com.squareup.retrofit2:retrofit-converters:2.5.0
+--- com.squareup.okhttp3:logging-interceptor:3.14.1
|    \--- com.squareup.okhttp3:okhttp:3.14.1 (*)
+--- com.squareup.okhttp3:okhttp:3.12.0 -> 3.14.1 (*)

you should use 3.12.0 logging-interceptor

implementation 'com.squareup.okhttp3:logging-interceptor:3.12.0'

OkHttp 3.13+ Requires Android 5+

The square/okhttp github page mentions that the minimum requirement is Android 5+

Github link

Medium link

As mentioned by @Jaeger, @fancyjyl for using with versions less than Android 5 we need to use OkHttp 3.12.x but it is not recommended to use it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!