简体   繁体   English

引起:java.lang.ClassNotFoundException:没有找到类“okhttp3.internal.Platform”

[英]Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.internal.Platform"

I tried find something for me, but it didn't help me.我试图为我找到一些东西,但它没有帮助我。

This is my gradle file:这是我的gradle文件:

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?错误在哪里?

Add this line:添加这一行:

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

and upgrade version of com.squareup.okhttp3:logging-interceptor to 3.6.0并将com.squareup.okhttp3:logging-interceptor版本升级到3.6.0

You can look last version here你可以在这里查看最新版本

最近更新的版本是implementation 'com.squareup.okhttp3:okhttp:3.11.0'

This is caused by using different versions of OkHttp.这是由于使用了不同版本的 OkHttp 造成的。 Ensure all your dependencies from com.squareup.okhttp3 are using the same version.确保 com.squareup.okhttp3 中的所有依赖项都使用相同的版本。 Ref: https://stackoverflow.com/a/59467567/7308789参考: https : //stackoverflow.com/a/59467567/7308789

添加这一行

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 原因:java.lang.ClassNotFoundException:在路径上找不到类 - Caused by: java.lang.ClassNotFoundException: Didn't find class on path 原因:java.lang.ClassNotFoundException:找不到类“ com.google.android.gms.common.internal.zzbq” - Caused by: java.lang.ClassNotFoundException: Didn't find class “com.google.android.gms.common.internal.zzbq” 由java.lang.ClassNotFoundException引起找不到类“ com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver - Caused by java.lang.ClassNotFoundException Didn't find class "com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver Android Studio错误:原因:java.lang.ClassNotFoundException:未找到类 - Android Studio error: Caused by: java.lang.ClassNotFoundException: Didn't find class 引起:java.lang.ClassNotFoundException:在 Firebase 电话身份验证中找不到类 - Caused by: java.lang.ClassNotFoundException: Didn't find class in Firebase Phone Authentication React Native java.lang.ClassNotFoundException:找不到类 - React Native java.lang.ClassNotFoundException: Didn't find class java.lang.ClassNotFoundException:找不到带有TeamCity构建的类 - java.lang.ClassNotFoundException: Didn't find class with TeamCity build java.lang.ClassNotFoundException:在路径:DexPathList上找不到类… - java.lang.ClassNotFoundException: Didn't find class … on path: DexPathList java.lang.ClassNotFoundException:在路径上找不到 class:dexpathlist - java.lang.ClassNotFoundException: Didn't find class on path: dexpathlist 引起:java.lang.ClassNotFoundException:路径上没有找到类“android.support.v4.animation.AnimatorCompatHelper”:DexPathList [[zip文件] - Caused by: java.lang.ClassNotFoundException: Didn't find class “android.support.v4.animation.AnimatorCompatHelper” on path: DexPathList[[zip file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM