No class found exception com.squareup.okhttp.logging.HttpLoggingInterceptor

后端 未结 3 686
粉色の甜心
粉色の甜心 2021-01-18 06:15

Even after adding the dependencies and importing the class I am getting java.lang.NoClassDefFoundError: com.squareup.okhttp.logging.HttpLoggingInterceptor.

Can anyon

3条回答
  •  礼貌的吻别
    2021-01-18 06:20

    In my case, I found that the versions of the okhttp3 and okhttp3:logging-interceptor dependencies needed to exactly match. So for example:

    ...
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    compile 'com.squareup.okhttp3:okhttp:3.4.1'
    compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    ...
    

提交回复
热议问题