retrofit: FATAL EXCEPTION: OkHttp Dispatcher with okhttp:3.0.0

My setup without the problem:

compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3'
compile 'com.squareup.okhttp3:okhttp:3.0.0-RC1'

My setup wit the problem and no code changes:

compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3'
compile 'com.squareup.okhttp3:okhttp:3.0.0'

Produces following error:

FATAL EXCEPTION: OkHttp Dispatcher
    Process: com.my.app, PID: 31176
    java.lang.AbstractMethodError: abstract method "void okhttp3.Callback.onResponse(okhttp3.Call, okhttp3.Response)"
      at okhttp3.RealCall$AsyncCall.execute(RealCall.java:133)
      at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:33)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
      at java.lang.Thread.run(Thread.java:818)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 34 (2 by maintainers)

Most upvoted comments

😭 If you are using logging interceptor you also need to properly version that:

compile 'com.squareup.okhttp3:okhttp:3.0.0-RC1'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.0-RC1'
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'

If you are using LoganSquare you also need:

apt 'com.bluelinelabs:logansquare-compiler:1.3.4'
compile 'com.bluelinelabs:logansquare:1.3.4'
compile 'com.github.aurae.retrofit2:converter-logansquare:1.2.

@sudhirkhanger you need change library with latest release stable version:

    compile 'com.squareup.retrofit2:retrofit:2.0.2'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'

retrofit:2.0.2 - default used okhttp-3.2.0 and OkHttpClient class exists in retrofit:2.0.2’ library. If you need add logger to requests then you can simply add:

    compile 'com.squareup.okhttp3:logging-interceptor:3.2.0

And all process will be works fine.

You need to use either:

  • OkHttp 3.0.1 with Retrofit 2.0.0-SNAPSHOT
  • OkHttp 3.0.0-RC1 with Retrofit 2.0.0-beta3 Both of these configurations are confirmed to work.

You could subscribe this page to get latest lib update. https://bintray.com/bintray/jcenter/com.squareup.retrofit2%3Aretrofit/view

@sudhirkhanger AFAK Android Studio only tells you about its official libraries (Android Support Libraries, Android Gradle plugin etc), and obviously Retrofit is (currently) not.