gpt4 book ai didi

java.lang.IllegalArgumentException : @Url cannot be used with @GET URL (parameter #1) 异常

转载 作者:搜寻专家 更新时间:2023-10-30 21:00:31 26 4
gpt4 key购买 nike

@GET("user/token/")
Observable<String> gToken(@Url String url, @Query("usertype") int userType);

我收到以下错误:

Process: com.gouhuoapp.say, PID: 12519
rx.exceptions.OnErrorNotImplementedException: @Url cannot be used with @GET URL (parameter #1)
for method ApiService.getToken
at rx.internal.util.InternalObservableUtils$ErrorNotImplementedAction.call(InternalObservableUtils.java:386)
at rx.internal.util.InternalObservableUtils$ErrorNotImplementedAction.call(InternalObservableUtils.java:383)
at rx.internal.util.ActionSubscriber.onError(ActionSubscriber.java:44)
at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:153)
at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:115)
at rx.exceptions.Exceptions.throwOrReport(Exceptions.java:216)
at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:139)
at rx.observers.SerializedObserver.onNext(SerializedObserver.java:91)
at rx.observers.SerializedSubscriber.onNext(SerializedSubscriber.java:94)
at rx.internal.operators.OperatorTakeUntil$1.onNext(OperatorTakeUntil.java:45)
at rx.internal.operators.OperatorThrottleFirst$1.onNext(OperatorThrottleFirst.java:53)
at com.jakewharton.rxbinding.view.ViewClickOnSubscribe$1.onClick(ViewClickOnSubscribe.java:23)
at android.view.View.performClick(View.java:4909)
at android.view.View$PerformClick.run(View.java:20390)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:192)
at android.app.ActivityThread.main(ActivityThread.java:5784)
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:1084)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:850)
Caused by: java.lang.IllegalArgumentException: @Url cannot be used with @GET URL (parameter #1)
for method ApiService.getToken
at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:720)
at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:711)
at retrofit2.ServiceMethod$Builder.parameterError(ServiceMethod.java:729)
at retrofit2.ServiceMethod$Builder.parseParameterAnnotation(ServiceMethod.java:367)
at retrofit2.ServiceMethod$Builder.parseParameter(ServiceMethod.java:333)
at retrofit2.ServiceMethod$Builder.build(ServiceMethod.java:202)
at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:166)
at retrofit2.Retrofit$1.invoke(Retrofit.java:145)
at java.lang.reflect.Proxy.invoke(Proxy.java:397)
at $Proxy3.getToken(Unknown Source)
at com.gouhuoapp.say.data.DataManager.getToken(DataManager.java:83)
at com.gouhuoapp.say.view.activity.RegisterMobileActivity.getQiniuToken(RegisterMobileActivity.java:171)
at com.gouhuoapp.say.view.activity.RegisterMobileActivity.lambda$initTitle$4(RegisterMobileActivity.java:153)
at com.gouhuoapp.say.view.activity.RegisterMobileActivity$$Lambda$7.call(Unknown Source)
at rx.internal.util.ActionSubscriber.onNext(ActionSubscriber.java:39)
at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:134)
... 15 more

最佳答案

错误的意思和它说的完全一样,您可以在参数上使用 GET(...)@Url,但不能同时使用这两者。如果您需要使用 @Url,请从 @GET 注释中删除 url。您需要将您在 url 参数中的 url 部分添加到您的 url 参数中。

@GET
Observable<String> gToken(@Url String url, @Query("usertype") int userType);

关于java.lang.IllegalArgumentException : @Url cannot be used with @GET URL (parameter #1) 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41168853/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com