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

java.lang.NoSuchMethodError: okhttp3.internal.Platform.log #2678

Closed
hacket opened this Issue Jun 29, 2016 · 1 comment

Comments

3 participants
@hacket

hacket commented Jun 29, 2016

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

my build.gradle

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

logging-interceptor3.2 HttpLoggingInterceptor

  public interface Logger {
    void log(String message);

    /** A {@link Logger} defaults output appropriate for the current platform. */
    Logger DEFAULT = new Logger() {
      @Override public void log(String message) {
        Platform.get().log(message);
      }
    };
  }

but in okhttp3.2 , Platform.get().log(String) method doesn't exist.

crash:

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:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:841)
@artem-zinnatullin

This comment has been minimized.

Show comment
Hide comment
@artem-zinnatullin

artem-zinnatullin Jun 29, 2016

Contributor

I guess some of your project dependencies require OkHttp 3.3.+ where
Platform.log() was changed and overrides version 3.2.0 of OkHttp specified
by you.

Can you please print tree of project dependencies and check what version of
OkHttp and what version of logging interceptor compiles to your project?
With Gradle it'll be :moduleName:dependencies

TL TR: You need to use same version of OkHttp and logging interceptor.

On Wed, 29 Jun 2016, 13:05 hacket, notifications@github.com wrote:

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

my build.gradle

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

logging-interceptor3.2 HttpLoggingInterceptor

public interface Logger {
void log(String message);

/** A {@link Logger} defaults output appropriate for the current platform. */
Logger DEFAULT = new Logger() {
  @Override public void log(String message) {
    Platform.get().log(message);
  }
};

}

but in okhttp3.2 , Platform.get().log(String) method doesn't exist.

crash:

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:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#2678, or mute the thread
https://github.com/notifications/unsubscribe/AA7B3GIMt1NIDFX8WQbEsb9K2Ke3s-9zks5qQkNYgaJpZM4JA-I4
.

Contributor

artem-zinnatullin commented Jun 29, 2016

I guess some of your project dependencies require OkHttp 3.3.+ where
Platform.log() was changed and overrides version 3.2.0 of OkHttp specified
by you.

Can you please print tree of project dependencies and check what version of
OkHttp and what version of logging interceptor compiles to your project?
With Gradle it'll be :moduleName:dependencies

TL TR: You need to use same version of OkHttp and logging interceptor.

On Wed, 29 Jun 2016, 13:05 hacket, notifications@github.com wrote:

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

my build.gradle

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

logging-interceptor3.2 HttpLoggingInterceptor

public interface Logger {
void log(String message);

/** A {@link Logger} defaults output appropriate for the current platform. */
Logger DEFAULT = new Logger() {
  @Override public void log(String message) {
    Platform.get().log(message);
  }
};

}

but in okhttp3.2 , Platform.get().log(String) method doesn't exist.

crash:

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:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#2678, or mute the thread
https://github.com/notifications/unsubscribe/AA7B3GIMt1NIDFX8WQbEsb9K2Ke3s-9zks5qQkNYgaJpZM4JA-I4
.

@swankjesse swankjesse closed this Jul 1, 2016

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