获取java.lang.NoSuchMethodError,无虚拟方法日志(ILjava/lang/String;Ljava/lang/Throwable;)

问题描述 投票:0回答:2

我已添加 Itercom 聊天以获得客户支持或联系我们。但是当我添加 Intercom sdk 依赖项时
实现'io.intercom.android:intercom-sdk-base:9.+')和应用程序运行然后崩溃我的应用程序。我收到如下错误

java.lang.NoSuchMethodError:没有虚拟方法日志(ILjava/lang/String;Ljava/lang/Throwable; V in class Lokhttp3/internal/platform/Platform;

或其超类(“okhttp3.internal.platform.Platform”的声明出现在 /data/app/com.exampla.app-Opatc6X6ZSZqGt8Wv1Uwty==/base.apk!classes3.dex 中)

android firebase dependencies intercom
2个回答
23
投票

您必须使用相同版本的okHttp库。 就我而言,是

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

抛出此异常的是

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

因此修复将在您的 build.gradle 文件中,您必须使用相同的版本:

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

它将解决您的问题。现在分享答案已经太晚了,但也可能对其他人有帮助。


0
投票

您需要在所有 okhttp 依赖项中具有相同的版本

© www.soinside.com 2019 - 2024. All rights reserved.