我使用翻新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是所有项目中唯一使用的版本。
如何解决?