9

I tried find something for me, but it didn't help me.

This is my gradle file:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(path: ':slideDateTimePicke')
    compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
        transitive = true;
    }
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'com.google.code.gson:gson:2.7'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
    compile 'com.facebook.stetho:stetho-okhttp3:1.4.2'
    compile 'cn.pedant.sweetalert:library:1.3'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'uk.co.chrisjenx:calligraphy:2.2.0'
    compile 'com.daimajia.slider:library:1.1.5@aar'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.google.android.gms:play-services-maps:10.2.1'
    compile 'com.google.android.gms:play-services-vision:10.2.1'
    compile 'com.google.firebase:firebase-messaging:10.2.1'
    compile 'com.google.zxing:core:3.2.0'
    compile 'com.makeramen:roundedimageview:2.2.1'
    compile 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.jakewharton:butterknife:8.5.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}

And this is my code:

private static OkHttpClient createClient() {
    return new OkHttpClient.Builder()
            .addInterceptor(createLoggingInterceptor())
            .build();
}

private static HttpLoggingInterceptor createLoggingInterceptor() {
    HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
    logging.setLevel(HttpLoggingInterceptor.Level.BASIC);
    return logging;
}

Where is error?

Artem
  • 4,569
  • 12
  • 44
  • 86

3 Answers3

28

Add this line:

implementation 'com.squareup.okhttp3:okhttp:3.6.0'

and upgrade version of com.squareup.okhttp3:logging-interceptor to 3.6.0

You can look last version here

AliSh
  • 10,085
  • 5
  • 44
  • 76
shmakova
  • 6,076
  • 3
  • 28
  • 44
  • I had this version - "3.2.0", and the issue resolved after moving to 3.6.0. But why it was failing for 3.2.0! – Ajith M A Sep 25 '20 at 08:17
1

This is caused by using different versions of OkHttp. Ensure all your dependencies from com.squareup.okhttp3 are using the same version. Ref: https://stackoverflow.com/a/59467567/7308789

Houssin Boulla
  • 2,687
  • 1
  • 16
  • 22
0

Recent updated version is implementation 'com.squareup.okhttp3:okhttp:3.11.0'

Aman Srivastava
  • 1,007
  • 1
  • 13
  • 25