-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
NoSuchMethodError: No virtual method log(Ljava/lang/String;)V in class Lokhttp3/internal/Platform; #2839
Comments
You need to use the same version for all of your OK dependencies. If you don’t, things won't work! |
I used the same version: Now i kown, the problem is caused by retrofit, i used : retrofit 2.1.0 used okhttp3.3.0, so ... |
Do not downgrade Retrofit. Upgrade OkHttp. On Wed, Sep 7, 2016, 1:52 AM ouyangzn notifications@github.com wrote:
|
ok , i know, thanks, i was ignore that okhttp's latest version is 3.4.1; |
Is there any where to look up which versions work together... I'm getting this with the latest versions of both... |
The version of all artifacts from OkHttp should always be the same.
…On Wed, Nov 30, 2016 at 4:42 PM Matthew Clark ***@***.***> wrote:
Is there any where to look up which versions work together... I'm getting
this with the latest versions of both...
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2839 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEaBtBf6Efw47V-xsq5UtUD2iXc05ks5rDe2_gaJpZM4J1luG>
.
|
I meant what versions of OkHttp that work with what versions of retrofit |
Every 3.x version of OkHttp should work with every 2.x version of Retrofit,
but in general, we ensure (and recommend) that the latest versions of each
are always working with each other.
…On Wed, Nov 30, 2016 at 4:55 PM Matthew Clark ***@***.***> wrote:
I meant what versions of OkHttp that work with what versions of retrofit
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2839 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEXOarCVeJwyqtsFAwVUcYW8vyEsmks5rDfC8gaJpZM4J1luG>
.
|
but still getting When I try to use the logging interceptor:
|
changed code to
and still getting the same error. |
If you run the 'dependencies' task on your module you should be able to see
the resolved versions to make sure they all match.
…On Wed, Nov 30, 2016 at 6:24 PM Matthew Clark ***@***.***> wrote:
changed code to
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).
build();
try {
Response resp = client.newCall(new Request.Builder().url(BASE_URL+"/b2w").build()).execute();
Log.d("MAIN","got resp:"+resp.body().toString());
} catch (IOException e) {
e.printStackTrace();
}
and still getting the same error.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2839 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEaxxaqiyJS_z9w7cTY_J4z4D-e3Rks5rDgXIgaJpZM4J1luG>
.
|
There is a "Gradle Console" tab in Android Studio, check what's there after
running the task. Or you can do it from Terminal: `./gradlew
:app:dependencies`.
…On Fri, Dec 2, 2016 at 9:08 AM, Matthew Clark ***@***.***> wrote:
I believe this is what you meant:
[image: screen shot 2016-12-02 at 12 07 43 am]
<https://cloud.githubusercontent.com/assets/484943/20824551/64d0999a-b823-11e6-9057-af648b7cc403.png>
and this was the results:
[image: screen shot 2016-12-02 at 12 02 37 am]
<https://cloud.githubusercontent.com/assets/484943/20824539/50171420-b823-11e6-9f4e-1267978f34c5.png>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2839 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA7B3N4SQmXsp_ILvDu5HUHZupRNkjF4ks5rD7XbgaJpZM4J1luG>
.
|
Here is what I'm hoping is the important info from the command line output:
Any ideas? Btw thanks @artem-zinnatullin for pointing the command line out^^ |
This solution facebook/react-native#27250 (comment) worked for me. |
I have the same problem,but i dont know how to solve it |
Cause of this problem is:
In order for the logging interceptor to work you will need to use exactly same version numbers in okhttp & logging interceptor. If you are using Retrofit, you can find the okhttp version inside retrofit from here: and use the same version for logging interceptor. |
it's fine if I delete
HttpLoggingInterceptor logging = new HttpLoggingInterceptor(); logging.setLevel(HttpLoggingInterceptor.Level.BASIC); builder.interceptors().add(logging);
but if i use okhttp3 logging-interceptor, throw this exception:
java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread. at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:62) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:154) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:833) Caused by: java.lang.NoSuchMethodError: No virtual method log(Ljava/lang/String;)V in class Lokhttp3/internal/Platform; or its super classes (declaration of 'okhttp3.internal.Platform' appears in /data/app/com.ouyangzn.topgithub-2/base.apk) 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.execute(RealCall.java:57) at retrofit2.OkHttpCall.execute(OkHttpCall.java:174) at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$RequestArbiter.request(RxJavaCallAdapterFactory.java:171) at rx.internal.operators.OperatorSubscribeOn$1$1$1$1.call(OperatorSubscribeOn.java:85) at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:222) at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:154) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:833)
The text was updated successfully, but these errors were encountered: