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

Art*_*rti 12 dependencies android firebase intercom

我已添加 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 中)

Ana*_*hah 26

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

implementation 'com.squareup.okhttp3:okhttp:4.9.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.6.0'
Run Code Online (Sandbox Code Playgroud)

哪个抛出了这个异常

java.lang.NoSuchMethodError: No virtual method log(ILjava/lang/String;Ljava/lang/Throwable; V in class Lokhttp3/internal/platform/Platform;
Run Code Online (Sandbox Code Playgroud)

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

implementation 'com.squareup.okhttp3:okhttp:4.9.2'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.2'
Run Code Online (Sandbox Code Playgroud)

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