您好我在我的代码中使用了自定义方法,如下所示,但它总是给我
java.lang.IllegalArgumentException:方法AUTH必须没有 请求正文。
我的代码无效,总是说:Custom method AUTH, must not have a Body
@Headers("Content-Type: application/json")
@HTTP(method = "AUTH", path = "login/{deviceId}", hasBody = true)
Call<Success> getLogin( @Path("deviceId") int deviceId, @Body RequestBody password);
我正在使用以下依赖。
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
你能帮我吗?
答案 0 :(得分:4)
我遇到了同样的问题,在搜索并深入研究文档后,我发现问题是retrofit
版本,请尝试使用版本2.4.0
。
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'