New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpLoggingInterceptor crashes when using DEFAULT Logger when using OkHttp 2.5 #1992

Closed
MartinHarkins opened this Issue Nov 12, 2015 · 4 comments

Comments

3 participants
@MartinHarkins

MartinHarkins commented Nov 12, 2015

The DEFAULT Logger in HttpLoggingInterceptor is using Platform.get().log(String) method. That method doesn't exist in OkHttp 2.5

build.gradle

compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.okhttp:logging-interceptor:2.6.0-SNAPSHOT'

Crash

java.lang.NoSuchMethodError: com.squareup.okhttp.internal.Platform.log
at com.squareup.okhttp.logging.HttpLoggingInterceptor$Logger$1.log(HttpLoggingInterceptor.java:109)
at com.squareup.okhttp.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:152)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:221)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:195)
at com.squareup.okhttp.Call.access$100(Call.java:34)
at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:162)
at com.squareup.okhttp.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:841)

Platform has a logW(String warning) method that could be used instead.
That or remove the HttpLoggingInterceptor() constructor if you want consumers to specify the Logger

@JakeWharton

This comment has been minimized.

Show comment
Hide comment
@JakeWharton

JakeWharton Nov 12, 2015

Collaborator

You have to use 2.6.0-SNAPSHOT of okhttp for this to work, or just copy/paste the interceptor and modify its implementation to use whatever logger you want. We don't support using multiple artifacts from the library with different versions.

Collaborator

JakeWharton commented Nov 12, 2015

You have to use 2.6.0-SNAPSHOT of okhttp for this to work, or just copy/paste the interceptor and modify its implementation to use whatever logger you want. We don't support using multiple artifacts from the library with different versions.

@MartinHarkins

This comment has been minimized.

Show comment
Hide comment
@MartinHarkins

MartinHarkins Nov 12, 2015

Thanks & confirmed that upgrading to 'com.squareup.okhttp:okhttp:2.6.0-SNAPSHOT' solves the problem.

MartinHarkins commented Nov 12, 2015

Thanks & confirmed that upgrading to 'com.squareup.okhttp:okhttp:2.6.0-SNAPSHOT' solves the problem.

@kiranbjm

This comment has been minimized.

Show comment
Hide comment
@kiranbjm

kiranbjm Aug 25, 2016

FATAL EXCEPTION: OkHttp Dispatcher java.lang.NoSuchMethodError: okhttp3.internal.Platform.log at okhttp3.logging.HttpLoggingInterceptor$Logger$1.log(HttpLoggingInterceptor.java:109) at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:157) at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:190) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:163) at okhttp3.RealCall.access$100(RealCall.java:30) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) at java.lang.Thread.run(Thread.java:856)

I am using
gradle
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'

Please help me I searched all over the net

kiranbjm commented Aug 25, 2016

FATAL EXCEPTION: OkHttp Dispatcher java.lang.NoSuchMethodError: okhttp3.internal.Platform.log at okhttp3.logging.HttpLoggingInterceptor$Logger$1.log(HttpLoggingInterceptor.java:109) at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:157) at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:190) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:163) at okhttp3.RealCall.access$100(RealCall.java:30) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) at java.lang.Thread.run(Thread.java:856)

I am using
gradle
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'

Please help me I searched all over the net

@JakeWharton

This comment has been minimized.

Show comment
Hide comment
@JakeWharton

JakeWharton Aug 25, 2016

Collaborator

That message indicates you are using a different logger version than the
main okhttp artifact. You can likely fix it by adding an explicit
dependency on OkHttp with the same version as the logger.

On Thu, Aug 25, 2016 at 10:31 AM kiranbjm notifications@github.com wrote:

FATAL EXCEPTION: OkHttp Dispatcher
java.lang.NoSuchMethodError: okhttp3.internal.Platform.log
at
okhttp3.logging.HttpLoggingInterceptor$Logger$1.log(HttpLoggingInterceptor.java:109)
at
okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:157)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:190)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:163)
at okhttp3.RealCall.access$100(RealCall.java:30)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)

I am using
gradle
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
#1992 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAEEEYGQFal_Ydt2XXLr4Y9PQx6fFt-wks5qjacwgaJpZM4Ghabg
.

Collaborator

JakeWharton commented Aug 25, 2016

That message indicates you are using a different logger version than the
main okhttp artifact. You can likely fix it by adding an explicit
dependency on OkHttp with the same version as the logger.

On Thu, Aug 25, 2016 at 10:31 AM kiranbjm notifications@github.com wrote:

FATAL EXCEPTION: OkHttp Dispatcher
java.lang.NoSuchMethodError: okhttp3.internal.Platform.log
at
okhttp3.logging.HttpLoggingInterceptor$Logger$1.log(HttpLoggingInterceptor.java:109)
at
okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:157)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:190)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:163)
at okhttp3.RealCall.access$100(RealCall.java:30)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)

I am using
gradle
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
#1992 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAEEEYGQFal_Ydt2XXLr4Y9PQx6fFt-wks5qjacwgaJpZM4Ghabg
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment