【问题标题】:java.lang.NoClassDefFoundError: okhttp3.OkHttpClient$Builderjava.lang.NoClassDefFoundError: okhttp3.OkHttpClient$Builder
【发布时间】:2018-03-07 13:24:02
【问题描述】:

我正在寻找 same issue 并尝试使用指定的解决方案,但仍然遇到与以下相同的错误

java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/OkHttpClient$Builder;

Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.OkHttpClient$Builder" on path: DexPathList[[zip file "path" ]]

我的 gradle 是这样的

compile 'io.realm:android-adapters:1.4.0'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex:rxandroid:1.1.0' 
compile 'io.reactivex:rxjava:1.1.3'    


compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
compile 'com.squareup.okhttp3:okhttp:3.9.0'

我的应用程序类扩展了 MultidexApplication。

【问题讨论】:

  • 您是否尝试清理/重建/重新启动 android studio?
  • 我尝试清理并重建 dint 尝试重新启动 android studio,它会有所帮助..
  • 我不知道。试试看,让我知道。
  • @Vucko dint 帮助

标签: java android retrofit rx-java2 okhttp3


【解决方案1】:

用这个更新你的 gradle 文件

android {
  defaultConfig {
    multiDexEnabled true
  }
}

【讨论】:

    猜你喜欢
    • 2016-12-16
    • 1970-01-01
    • 1970-01-01
    • 2016-04-30
    • 2017-08-24
    • 1970-01-01
    • 2021-04-01
    • 1970-01-01
    相关资源
    最近更新 更多