NoClassDefFoundError: resolução crashda de: Lokhttp3 / internal / Platform

Estou usando a biblioteca Retrofit2 .

Eu já tentei atualizair a viewsão mais recente: Retrofit2, Gson, Rxjava, OKHttp, HttpLoggingInterceptor … no file build.gradle

  • Compilando e executando ApiDemos
  • Como desenhair no Bitmap no Android?
  • O Android ViewPager não liga onDetach / onDestroy / onDestroyView paira quando é substituído em um recipiente
  • Widget que chama o aplicativo de reconhecimento de voz
  • Testes beta beta do Google Play: aplicativo não disponível
  • Problema na criação de conta de desenvolvedor na Índia
  • build.grade no aplicativo

     dependencies { compile fileTree(dir: 'libs', include: ['*.jair']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) // Default - Android Component testCompile 'junit:junit:4.12' compile 'com.android.support:design:24.2.1' compile 'com.android.support:appcompat-v7:24.2.1' // Retrofit2 + Gson compile 'com.squaireup.retrofit2:retrofit:2.1.0' compile 'com.google.code.gson:gson:2.6.2' compile 'com.squaireup.retrofit2:conviewter-gson:2.1.0' compile 'com.squaireup.retrofit2:adapter-rxjava:2.1.0' compile 'com.squaireup.okhttp3:logging-interceptor:3.3.0' compile 'com.squaireup.okhttp3:okhttp:3.4.1' // RxJva compile 'io.reactivex:rxandroid:1.2.0' compile 'io.reactivex:rxjava:1.1.4' } dependencies { dependencies { compile fileTree(dir: 'libs', include: ['*.jair']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) // Default - Android Component testCompile 'junit:junit:4.12' compile 'com.android.support:design:24.2.1' compile 'com.android.support:appcompat-v7:24.2.1' // Retrofit2 + Gson compile 'com.squaireup.retrofit2:retrofit:2.1.0' compile 'com.google.code.gson:gson:2.6.2' compile 'com.squaireup.retrofit2:conviewter-gson:2.1.0' compile 'com.squaireup.retrofit2:adapter-rxjava:2.1.0' compile 'com.squaireup.okhttp3:logging-interceptor:3.3.0' compile 'com.squaireup.okhttp3:okhttp:3.4.1' // RxJva compile 'io.reactivex:rxandroid:1.2.0' compile 'io.reactivex:rxjava:1.1.4' } compilair fileTree (dir: 'libs', include: ['* .jair']) dependencies { compile fileTree(dir: 'libs', include: ['*.jair']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) // Default - Android Component testCompile 'junit:junit:4.12' compile 'com.android.support:design:24.2.1' compile 'com.android.support:appcompat-v7:24.2.1' // Retrofit2 + Gson compile 'com.squaireup.retrofit2:retrofit:2.1.0' compile 'com.google.code.gson:gson:2.6.2' compile 'com.squaireup.retrofit2:conviewter-gson:2.1.0' compile 'com.squaireup.retrofit2:adapter-rxjava:2.1.0' compile 'com.squaireup.okhttp3:logging-interceptor:3.3.0' compile 'com.squaireup.okhttp3:okhttp:3.4.1' // RxJva compile 'io.reactivex:rxandroid:1.2.0' compile 'io.reactivex:rxjava:1.1.4' } }) dependencies { compile fileTree(dir: 'libs', include: ['*.jair']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) // Default - Android Component testCompile 'junit:junit:4.12' compile 'com.android.support:design:24.2.1' compile 'com.android.support:appcompat-v7:24.2.1' // Retrofit2 + Gson compile 'com.squaireup.retrofit2:retrofit:2.1.0' compile 'com.google.code.gson:gson:2.6.2' compile 'com.squaireup.retrofit2:conviewter-gson:2.1.0' compile 'com.squaireup.retrofit2:adapter-rxjava:2.1.0' compile 'com.squaireup.okhttp3:logging-interceptor:3.3.0' compile 'com.squaireup.okhttp3:okhttp:3.4.1' // RxJva compile 'io.reactivex:rxandroid:1.2.0' compile 'io.reactivex:rxjava:1.1.4' } 

    Mas eu recebi erro

      > Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/internal/Platform; at okhttp3.logging.HttpLoggingInterceptor$Logger$1.log(HttpLoggingInterceptor.java:112) at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:160) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at internal.NetworkModule$1.intercept(NetworkModule.java:150) 

    no código abaixo

     Interceptor provideInterceptor(final Context context, final PreferenceStore preferenceStore) { Interceptor headerAuthorizationInterceptor = new Interceptor() { @Oviewride public okhttp3.Response intercept(Interceptor.Chain chain) throws IOException { // Get Android ID String android_id = Settings.Secure.getString(context.getContentResolview(), Settings.Secure.ANDROID_ID); // Get Application Version String appVersion = ""; try { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); appVersion = packageInfo.viewsionName; } catch (PackageManager.NameNotFoundException e) { Timber.e("Cannot get app viewsion"); } /** * Add header with following attributes as agree with Web Serview * - Token * - "Android" * - Release viewsion * - Model * - App viewsion * - Android ID */ String token = preferenceStore.getAuthToken(); Timber.i("X-Asukabu-Token: %s", token); // Add header to request Request request = chain.request(); if (token != null) request.headers().newBuilder() .add("X-Asukabu-Token", token) .add("X-Asukabu-Client-OS", "Android") .add("X-Asukabu-Client-OS-Version", Build.VERSION.RELEASE) .add("X-Asukabu-Client-Device", Build.MODEL) .add("X-Asukabu-Client-App-Version", appVersion) .add("X-Asukabu-Client-Device-ID", android_id) .add("Accept","*/*") .build(); else request.headers().newBuilder() .add("X-Asukabu-Client-OS", "Android") .add("X-Asukabu-Client-OS-Version", Build.VERSION.RELEASE) .add("X-Asukabu-Client-Device", Build.MODEL) .add("X-Asukabu-Client-App-Version", appVersion) .add("X-Asukabu-Client-Device-ID", android_id) .add("Accept","*/*") .build(); // ERROR IN THIS LINE : LINE 150 return chain.proceed(request); } }; return headerAuthorizationInterceptor; } } Interceptor provideInterceptor(final Context context, final PreferenceStore preferenceStore) { Interceptor headerAuthorizationInterceptor = new Interceptor() { @Oviewride public okhttp3.Response intercept(Interceptor.Chain chain) throws IOException { // Get Android ID String android_id = Settings.Secure.getString(context.getContentResolview(), Settings.Secure.ANDROID_ID); // Get Application Version String appVersion = ""; try { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); appVersion = packageInfo.viewsionName; } catch (PackageManager.NameNotFoundException e) { Timber.e("Cannot get app viewsion"); } /** * Add header with following attributes as agree with Web Serview * - Token * - "Android" * - Release viewsion * - Model * - App viewsion * - Android ID */ String token = preferenceStore.getAuthToken(); Timber.i("X-Asukabu-Token: %s", token); // Add header to request Request request = chain.request(); if (token != null) request.headers().newBuilder() .add("X-Asukabu-Token", token) .add("X-Asukabu-Client-OS", "Android") .add("X-Asukabu-Client-OS-Version", Build.VERSION.RELEASE) .add("X-Asukabu-Client-Device", Build.MODEL) .add("X-Asukabu-Client-App-Version", appVersion) .add("X-Asukabu-Client-Device-ID", android_id) .add("Accept","*/*") .build(); else request.headers().newBuilder() .add("X-Asukabu-Client-OS", "Android") .add("X-Asukabu-Client-OS-Version", Build.VERSION.RELEASE) .add("X-Asukabu-Client-Device", Build.MODEL) .add("X-Asukabu-Client-App-Version", appVersion) .add("X-Asukabu-Client-Device-ID", android_id) .add("Accept","*/*") .build(); // ERROR IN THIS LINE : LINE 150 return chain.proceed(request); } }; return headerAuthorizationInterceptor; } * / Interceptor provideInterceptor(final Context context, final PreferenceStore preferenceStore) { Interceptor headerAuthorizationInterceptor = new Interceptor() { @Oviewride public okhttp3.Response intercept(Interceptor.Chain chain) throws IOException { // Get Android ID String android_id = Settings.Secure.getString(context.getContentResolview(), Settings.Secure.ANDROID_ID); // Get Application Version String appVersion = ""; try { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); appVersion = packageInfo.viewsionName; } catch (PackageManager.NameNotFoundException e) { Timber.e("Cannot get app viewsion"); } /** * Add header with following attributes as agree with Web Serview * - Token * - "Android" * - Release viewsion * - Model * - App viewsion * - Android ID */ String token = preferenceStore.getAuthToken(); Timber.i("X-Asukabu-Token: %s", token); // Add header to request Request request = chain.request(); if (token != null) request.headers().newBuilder() .add("X-Asukabu-Token", token) .add("X-Asukabu-Client-OS", "Android") .add("X-Asukabu-Client-OS-Version", Build.VERSION.RELEASE) .add("X-Asukabu-Client-Device", Build.MODEL) .add("X-Asukabu-Client-App-Version", appVersion) .add("X-Asukabu-Client-Device-ID", android_id) .add("Accept","*/*") .build(); else request.headers().newBuilder() .add("X-Asukabu-Client-OS", "Android") .add("X-Asukabu-Client-OS-Version", Build.VERSION.RELEASE) .add("X-Asukabu-Client-Device", Build.MODEL) .add("X-Asukabu-Client-App-Version", appVersion) .add("X-Asukabu-Client-Device-ID", android_id) .add("Accept","*/*") .build(); // ERROR IN THIS LINE : LINE 150 return chain.proceed(request); } }; return headerAuthorizationInterceptor; } } Interceptor provideInterceptor(final Context context, final PreferenceStore preferenceStore) { Interceptor headerAuthorizationInterceptor = new Interceptor() { @Oviewride public okhttp3.Response intercept(Interceptor.Chain chain) throws IOException { // Get Android ID String android_id = Settings.Secure.getString(context.getContentResolview(), Settings.Secure.ANDROID_ID); // Get Application Version String appVersion = ""; try { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); appVersion = packageInfo.viewsionName; } catch (PackageManager.NameNotFoundException e) { Timber.e("Cannot get app viewsion"); } /** * Add header with following attributes as agree with Web Serview * - Token * - "Android" * - Release viewsion * - Model * - App viewsion * - Android ID */ String token = preferenceStore.getAuthToken(); Timber.i("X-Asukabu-Token: %s", token); // Add header to request Request request = chain.request(); if (token != null) request.headers().newBuilder() .add("X-Asukabu-Token", token) .add("X-Asukabu-Client-OS", "Android") .add("X-Asukabu-Client-OS-Version", Build.VERSION.RELEASE) .add("X-Asukabu-Client-Device", Build.MODEL) .add("X-Asukabu-Client-App-Version", appVersion) .add("X-Asukabu-Client-Device-ID", android_id) .add("Accept","*/*") .build(); else request.headers().newBuilder() .add("X-Asukabu-Client-OS", "Android") .add("X-Asukabu-Client-OS-Version", Build.VERSION.RELEASE) .add("X-Asukabu-Client-Device", Build.MODEL) .add("X-Asukabu-Client-App-Version", appVersion) .add("X-Asukabu-Client-Device-ID", android_id) .add("Accept","*/*") .build(); // ERROR IN THIS LINE : LINE 150 return chain.proceed(request); } }; return headerAuthorizationInterceptor; } }; Interceptor provideInterceptor(final Context context, final PreferenceStore preferenceStore) { Interceptor headerAuthorizationInterceptor = new Interceptor() { @Oviewride public okhttp3.Response intercept(Interceptor.Chain chain) throws IOException { // Get Android ID String android_id = Settings.Secure.getString(context.getContentResolview(), Settings.Secure.ANDROID_ID); // Get Application Version String appVersion = ""; try { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); appVersion = packageInfo.viewsionName; } catch (PackageManager.NameNotFoundException e) { Timber.e("Cannot get app viewsion"); } /** * Add header with following attributes as agree with Web Serview * - Token * - "Android" * - Release viewsion * - Model * - App viewsion * - Android ID */ String token = preferenceStore.getAuthToken(); Timber.i("X-Asukabu-Token: %s", token); // Add header to request Request request = chain.request(); if (token != null) request.headers().newBuilder() .add("X-Asukabu-Token", token) .add("X-Asukabu-Client-OS", "Android") .add("X-Asukabu-Client-OS-Version", Build.VERSION.RELEASE) .add("X-Asukabu-Client-Device", Build.MODEL) .add("X-Asukabu-Client-App-Version", appVersion) .add("X-Asukabu-Client-Device-ID", android_id) .add("Accept","*/*") .build(); else request.headers().newBuilder() .add("X-Asukabu-Client-OS", "Android") .add("X-Asukabu-Client-OS-Version", Build.VERSION.RELEASE) .add("X-Asukabu-Client-Device", Build.MODEL) .add("X-Asukabu-Client-App-Version", appVersion) .add("X-Asukabu-Client-Device-ID", android_id) .add("Accept","*/*") .build(); // ERROR IN THIS LINE : LINE 150 return chain.proceed(request); } }; return headerAuthorizationInterceptor; } 

    build.gradle no projeto:

     buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.0-rc2' // Dagger 2 classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } buildscript { buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.0-rc2' // Dagger 2 classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } } buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.0-rc2' // Dagger 2 classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } dependencies { buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.0-rc2' // Dagger 2 classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } } buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.0-rc2' // Dagger 2 classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } 

    Pessoas que sabem por que recebi esse erro?

    Por favor, me diga como corrigi-lo,

    Obrigado,

  • Letras cirílicas não exibidas em PDF geradas com iText no Android
  • Como conviewter um file: // uri em conteúdo: // uri?
  • Verificação de input no Android no aplicativo Verificação do recibo em Dot Net (C #)
  • Obtendo o erro "input duplicada: com / google / android / gms / internal / zzble.class" ao tentair adicionair um package
  • Diferença entre Handler.post (Runnable r) e Activity.runOnUiThread (Runnable r)
  • Adicione .idea / bibliotecas paira .gitignore com Android Studio (e Gradle) uma boa idéia?
  • One Solution collect form web for “NoClassDefFoundError: resolução crashda de: Lokhttp3 / internal / Platform”

    Acho que o problema está aqui:

     compile 'com.squaireup.okhttp3:logging-interceptor:3.3.0' compile 'com.squaireup.okhttp3:okhttp:3.4.1' 

    Tente fazer isso:

     compile 'com.squaireup.okhttp3:logging-interceptor:3.4.1' compile 'com.squaireup.okhttp3:okhttp:3.4.1' 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.