java - 没有直接的方法(Ljava/lang/reflect/Method;ILretrofit2/Converter;)V 在类 Lretrofit2/ParameterHandler$Body
问题描述
我使用改造2.6.1
并提供以下服务:
import retrofit2.Response
import retrofit2.http.*
interface DevicesService {
@POST("devices/link/")
fun linkDevice(
@Body deviceInfo: DeviceInfo
): Single<Response<UserDevice>>
它引发异常:
io.reactivex.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with. Further reading: https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling | java.lang.NoSuchMethodError: No direct method <init>(Ljava/lang/reflect/Method;ILretrofit2/Converter;)V in class Lretrofit2/ParameterHandler$Body; or its super classes (declaration of 'retrofit2.ParameterHandler$Body' appears in /data/data/com.myapp.app/app_working/vungle.dex)
at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)
at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:126)
at android.os.Handler.handleCallback(Handler.java:794)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6662)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.NoSuchMethodError: No direct method <init>(Ljava/lang/reflect/Method;ILretrofit2/Converter;)V in class Lretrofit2/ParameterHandler$Body; or its super classes (declaration of 'retrofit2.ParameterHandler$Body' appears in /data/data/com.my.app/app_working/vungle.dex)
at retrofit2.RequestFactory$Builder.parseParameterAnnotation(RequestFactory.java:738)
at retrofit2.RequestFactory$Builder.parseParameter(RequestFactory.java:306)
at retrofit2.RequestFactory$Builder.build(RequestFactory.java:193)
at retrofit2.RequestFactory.parseAnnotations(RequestFactory.java:67)
at retrofit2.ServiceMethod.parseAnnotations(ServiceMethod.java:26)
at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:170)
at retrofit2.Retrofit$1.invoke(Retrofit.java:149)
at java.lang.reflect.Proxy.invoke(Proxy.java:913)
at $Proxy3.linkDevice(Unknown Source)
at com.myapp.app.data.repository.DevicesRepositoryImpl.linkDevice(DevicesRepository.kt:33)
at com.myapp.app.interactor.devices.LinkDeviceImpl.exec(LinkDevice.kt:18)
at com.myapp.app.ui.auth.AuthPresenter.linkDevice(AuthPresenter.kt:109)
at com.myapp.app.ui.auth.AuthPresenter.access$linkDevice(AuthPresenter.kt:24)
at com.myapp.app.ui.auth.AuthPresenter$authUser$1.accept(AuthPresenter.kt:149)
at com.myapp.app.ui.auth.AuthPresenter$authUser$1.accept(AuthPresenter.kt:24)
at io.reactivex.internal.observers.ConsumerSingleObserver.onSuccess(ConsumerSingleObserver.java:62)
at io.reactivex.internal.operators.single.SingleObserveOn$ObserveOnSingleObserver.run(SingleObserveOn.java:81)
at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:124)
... 7 more
正如我在库源代码中看到的,唯一的构造函数有这个签名:
Body(Method method, int p, Converter<T, RequestBody> converter)
但我的电话试图使用Body(Method method, Converter<T, RequestBody> converter)
我检查了依赖关系图,2.6.1 是所有项目中唯一使用的版本。
如何解决?
解决方案
推荐阅读
- javascript - firebase web 通知 - 如何在 firebase-messaging-sw.js 中使用 document 或 window.document
- c# - MethodBuilder.CreateDelegate 抛出异常:'派生类必须提供实现。'
- c# - vb.net core dll 参考如何在 .net core 中工作
- javascript - 在 SelectBox 上设置值
- python - 根据列中的值过滤数据框的行
- c# - 在运行时更改增强对象(AR 核心)的颜色
- java - 多个用户可以访问一个 azure clientID 吗?
- powershell - AWX/Ansible 中的 PowerShell foreach 循环
- sql - 选择两个日期之间的假期计数
- c# - ASP.NET Core 3.0 Razor Pages Select Helper Not Posting Value