Arti
Arti

Reputation: 970

Getting java.lang.NoSuchMethodError, No virtual method log(ILjava/lang/String;Ljava/lang/Throwable;)

I have add Itercom Chat for Customer support or Contact Us. But When I add Intercom sdk dependency
(implementation 'io.intercom.android:intercom-sdk-base:9.+') and App run then crash my App. i get error like below

java.lang.NoSuchMethodError: No virtual method log(ILjava/lang/String;Ljava/lang/Throwable; V in class Lokhttp3/internal/platform/Platform;

or its super classes (declaration of 'okhttp3.internal.platform.Platform' appears in /data/app/com.exampla.app-Opatc6X6ZSZqGt8Wv1Uwty==/base.apk!classes3.dex)

Upvotes: 16

Views: 18053

Answers (1)

Anant Shah
Anant Shah

Reputation: 4044

You have to use the same version of the okHttp library. in my case it was

implementation 'com.squareup.okhttp3:okhttp:4.9.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.6.0'

Which was throwing this exception which is

java.lang.NoSuchMethodError: No virtual method log(ILjava/lang/String;Ljava/lang/Throwable; V in class Lokhttp3/internal/platform/Platform;

So fix will be in your build.gradle file you have to use same versions:

implementation 'com.squareup.okhttp3:okhttp:4.9.2'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.2'

It will fix your issue. This is too late to share an answer but might help others also.

Upvotes: 33

Related Questions