NoSuchMethodError Lcom/google/gson/Gson;根据改造响应 [英] NoSuchMethodError Lcom/google/gson/Gson; upon retrofit response

查看:251
本文介绍了NoSuchMethodError Lcom/google/gson/Gson;根据改造响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我的应用发布了将近一年,但没有看到此问题,现在它出现了.
即使是现在,我的手机上的调试版本也没有这个问题.从Android Studio打开的任何模拟器都没有任何问题.但是,在收到Retrofit响应后,几乎所有来自Google开发者控制台中预发布报告的仿真器都会由于此NoSuchMethodError而崩溃.

So, I've had my app published for nearly a year without seeing this issue, and now it shows up.
Even right now, I don't have this issue with the debug version on my phone. I don't have any issues with any emulators opened from Android Studio. However nearly every emulator from the pre-launch reports in the Google Developer Console crashes with this NoSuchMethodError upon receiving Retrofit response.

FATAL EXCEPTION: ControllerMessenger
Process: xxxxxxx, PID: 25090
java.lang.NoSuchMethodError: No direct method <init>(Lcom/google/gson/Gson;)V in class Lcom/google/gson/Gson$1; or its super classes (declaration of 'com.google.gson.Gson$1' appears in /data/app/com.google.android.apps.mtaas.crawler-1/base.apk)
at com.google.gson.Gson.doubleAdapter(Gson.java:278)
at com.google.gson.Gson.<init>(Gson.java:217)
at com.google.gson.Gson.<init>(Gson.java:174)
at retrofit2.converter.gson.GsonConverterFactory.create(GsonConverterFactory.java:42)
at xxxxxxx.MtbActivity.loadJSON(MtbActivity.java:149)
at xxxxxxx.MtbActivity.onCreate(MtbActivity.java:135)
at android.app.Activity.performCreate(Activity.java:6013)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2359)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2466)
at android.app.ActivityThread.access$1200(ActivityThread.java:152)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1341)
at android.os.Handler.dispatchMessage(Handler.java:102)
at androidx.test.espresso.base.Interrogator.a(Interrogator.java:19)
at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:142)
at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:134)
at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:114)
at androidx.test.espresso.action.Tap$1.b(Tap.java:6)
at androidx.test.espresso.action.GeneralClickAction.perform(GeneralClickAction.java:22)
at androidx.test.espresso.ViewInteraction$SingleExecutionViewAction.perform(ViewInteraction.java:9)
at androidx.test.espresso.ViewInteraction.a(ViewInteraction.java:78)
at androidx.test.espresso.ViewInteraction.a(ViewInteraction.java:94)
at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:3)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5538)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

我尝试过的事情:

  1. 将Retrofit和Gson依赖项更新为最新版本.
  2. 使缓存无效并重新启动

implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'

推荐答案

感谢彼得总结:

现有的搜寻器为FUBAR.作为一种解决方法,您可以选择退出新发布的爬虫,以返回到该爬虫的先前版本.

The existing crawler is FUBAR. As a workaround you can go back to the previous version of the crawler by opting out of the newly released one.

以下是退出的方法:

登录到您的Play控制台. 选择一个应用. 选择发布管理>预发布报告>设置.在发布前报告版本"部分中,将退出"开关移至右侧,直到其变为蓝色. 此后,启动报告将再次正确显示.

Sign in to your Play Console. Select an app. Select Release management > Pre-launch report > Settings. In the "Pre-launch report version" section, move the Opt-out switch to the right until it turns blue. After this, the launch reports appear correctly again.

这篇关于NoSuchMethodError Lcom/google/gson/Gson;根据改造响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆