square / retrofit

A type-safe HTTP client for Android and the JVM
https://square.github.io/retrofit/
Apache License 2.0
43.1k stars 7.3k forks source link

AbstractMethodError occuring despite proper OKHttp <-> Retrofit versions #1519

Closed patrykpoborca closed 8 years ago

patrykpoborca commented 8 years ago

I'm getting the AbstractMethodError with this build.gradle... I saw talk about having the proper versions of retrofit2 and okhttp3 shown at this issue... but even after setting them up I still get the error. (I am using Kotlin. Perhaps this is a contributing factor?)

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile "com.android.support:appcompat-v7:$support_version"
    compile "com.android.support:design:$support_version"
    compile "com.android.support:cardview-v7:$support_version"
    compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
    compile "com.squareup.retrofit2:converter-gson:$retrofitVersion"
    compile "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion"
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    compile "com.facebook.stetho:stetho:$stethoVersion"
    compile "com.facebook.stetho:stetho-okhttp3:$stethoVersion"
    compile 'com.squareup.okhttp3:okhttp:3.0.0-RC1'
    compile 'com.google.code.gson:gson:2.5'
}
buildscript {
    ext.kotlin_version = '1.0.0-beta-4589'
    ext.support_version = '23.1.1'
    ext.retrofitVersion = '2.0.0-beta3'
    ext.stethoVersion = '1.3.0';

    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}
01-24 13:00:54.080 22373-22467/patrykpoborca.io.vocabstretch E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
                                                                               Process: patrykpoborca.io.vocabstretch, PID: 22373
                                                                               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)

On seperate note, if I was using the rx-java adapter originally but I was getting an IllegalStateException.closed so I tried the regular Call from Retrofit and got the above instead...

nikamipara commented 8 years ago

Config okhttp 3.0.0 with retrofit 2.0.0-snapshot also dont work

compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:design:23.1.1' compile 'com.android.support:support-v4:23.1.1' compile 'com.nineoldandroids:library:2.4.0' compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3' compile 'com.squareup.retrofit2:retrofit:2.0.0-SNAPSHOT' provided 'org.glassfish:javax.annotation:10.0-b28' compile 'com.github.bumptech.glide:glide:3.5.2' compile 'com.jakewharton:butterknife:7.0.1'

JakeWharton commented 8 years ago

That won't use the snapshot because you are using an older version of the Gson converter.

Both of you can use the 'dependencies' task to see that an older version of Retrofit is actually being used.

On Sun, Jan 24, 2016, 2:30 PM Nikunj notifications@github.com wrote:

Config okhttp 3.0.0 with retrofit 2.0.0-snapshot also dont work

compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:design:23.1.1' compile 'com.android.support:support-v4:23.1.1' compile 'com.nineoldandroids:library:2.4.0' compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3' compile 'com.squareup.retrofit2:retrofit:2.0.0-SNAPSHOT' provided 'org.glassfish:javax.annotation:10.0-b28' compile 'com.github.bumptech.glide:glide:3.5.2' compile 'com.jakewharton:butterknife:7.0.1'

— Reply to this email directly or view it on GitHub https://github.com/square/retrofit/issues/1519#issuecomment-174333123.

patrykpoborca commented 8 years ago

@JakeWharton
It looks like the proper version is being used no? Or am i thinking of the wrong command

gist to keep formatting +--- com.android.support:appcompat-v7:23.1.1 | \--- com.android.support:support-v4:23.1.1 | \--- com.android.support:support-annotations:23.1.1 +--- com.android.support:design:23.1.1 | +--- com.android.support:appcompat-v7:23.1.1 (*) | +--- com.android.support:recyclerview-v7:23.1.1 | | +--- com.android.support:support-annotations:23.1.1 | | \--- com.android.support:support-v4:23.1.1 (*) | \--- com.android.support:support-v4:23.1.1 (*) +--- com.android.support:cardview-v7:23.1.1 +--- com.squareup.retrofit2:retrofit:2.0.0-beta3 | \--- com.squareup.okhttp3:okhttp:3.0.0-RC1 -> 3.0.1 | \--- com.squareup.okio:okio:1.6.0 +--- com.squareup.retrofit2:converter-gson:2.0.0-beta3 | +--- com.squareup.retrofit2:retrofit:2.0.0-beta3 (*) | \--- com.google.code.gson:gson:2.4 -> 2.5 +--- com.squareup.retrofit2:adapter-rxjava:2.0.0-beta3 | +--- com.squareup.retrofit2:retrofit:2.0.0-beta3 (*) | \--- io.reactivex:rxjava:1.1.0 +--- org.jetbrains.kotlin:kotlin-stdlib:1.0.0-beta-4589 | \--- org.jetbrains.kotlin:kotlin-runtime:1.0.0-beta-4589 +--- com.facebook.stetho:stetho:1.3.0 | +--- com.google.code.findbugs:jsr305:2.0.1 | \--- commons-cli:commons-cli:1.2 +--- com.facebook.stetho:stetho-okhttp3:1.3.0 | +--- com.google.code.findbugs:jsr305:2.0.1 | +--- com.squareup.okhttp3:okhttp:3.0.1 (*) | \--- com.facebook.stetho:stetho:1.3.0 (*) +--- com.squareup.okhttp3:okhttp:3.0.0-RC1 -> 3.0.1 (*) +--- com.google.code.gson:gson:2.5 +--- com.android.databinding:library:1.0-rc3 | +--- com.android.databinding:baseLibrary:1.0-rc3 -> 1.0-rc5 | \--- com.android.support:support-v4:21.0.3 -> 23.1.1 (*) +--- com.android.databinding:baseLibrary:1.0-rc5 \--- com.android.databinding:adapters:1.0-rc3 \--- com.android.databinding:library:1.0-rc3 (*)

JakeWharton commented 8 years ago

That shows 2.0.0-beta3 is being used with OkHttp 3.0.1 which will not work. 2.0.0-SNAPSHOT needs to be used.

On Sun, Jan 24, 2016, 7:42 PM Patryk Poborca notifications@github.com wrote:

@JakeWharton https://github.com/JakeWharton

It looks like the proper version is being used no? Or am i thinking of the wrong command +--- com.android.support:appcompat-v7:23.1.1 | --- com.android.support:support-v4:23.1.1 | --- com.android.support:support-annotations:23.1.1 +--- com.android.support:design:23.1.1 | +--- com.android.support:appcompat-v7:23.1.1 () | +--- com.android.support:recyclerview-v7:23.1.1 | | +--- com.android.support:support-annotations:23.1.1 | | --- com.android.support:support-v4:23.1.1 () | --- com.android.support:support-v4:23.1.1 () +--- com.android.support:cardview-v7:23.1.1 +--- com.squareup.retrofit2:retrofit:2.0.0-beta3 | --- com.squareup.okhttp3:okhttp:3.0.0-RC1 -> 3.0.1 | --- com.squareup.okio:okio:1.6.0 +--- com.squareup.retrofit2:converter-gson:2.0.0-beta3 | +--- com.squareup.retrofit2:retrofit:2.0.0-beta3 () | --- com.google.code.gson:gson:2.4 -> 2.5 +--- com.squareup.retrofit2:adapter-rxjava:2.0.0-beta3 | +--- com.squareup.retrofit2:retrofit:2.0.0-beta3 () | --- io.reactivex:rxjava:1.1.0 +--- org.jetbrains.kotlin:kotlin-stdlib:1.0.0-beta-4589 | --- org.jetbrains.kotlin:kotlin-runtime:1.0.0-beta-4589 +--- com.facebook.stetho:stetho:1.3.0 | +--- com.google.code.findbugs:jsr305:2.0.1 | --- commons-cli:commons-cli:1.2 +--- com.facebook.stetho:stetho-okhttp3:1.3.0 | +--- com.google.code.findbugs:jsr305:2.0.1 | +--- com.squareup.okhttp3:okhttp:3.0.1 () | --- com.facebook.stetho:stetho:1.3.0 () +--- com.squareup.okhttp3:okhttp:3.0.0-RC1 -> 3.0.1 () +--- com.google.code.gson:gson:2.5 +--- com.android.databinding:library:1.0-rc3 | +--- com.android.databinding:baseLibrary:1.0-rc3 -> 1.0-rc5 | --- com.android.support:support-v4:21.0.3 -> 23.1.1 () +--- com.android.databinding:baseLibrary:1.0-rc5 --- com.android.databinding:adapters:1.0-rc3 --- com.android.databinding:library:1.0-rc3 ()

— Reply to this email directly or view it on GitHub https://github.com/square/retrofit/issues/1519#issuecomment-174357373.

patrykpoborca commented 8 years ago

Yep. thanks for pointing that out. I totally missed that. Didn't realize it was changing... Is the reason for this because my other dependencies simply haven't updated to the OKHttp?

Also to anyone else, don't forget to add this to your project build.gradle (I had it in my buildscript in my app/build.gradle and gradle couldn't find the snapshot... whooops.