what does Method getResources not annotated with request type (e.g., GET, POST) mean?

后端 未结 3 1272
鱼传尺愫
鱼传尺愫 2021-01-19 06:02
private interface ResourcesApi {
        @POST(\"/synchronize\")
        void getResources(@Body Map> map,
                           


        
相关标签:
3条回答
  • 2021-01-19 06:14

    It means the @POST annotation can't be found at runtime. Without the HTTP method type (and relative URL it contains), Retrofit cannot make the request.

    Are you using Proguard or another tool to trim "unused" code? If so, instruct it to keep Retrofit's annotations.

    0 讨论(0)
  • 2021-01-19 06:21

    Agree with @chad's answer, add below lines if still getting crash.

    -keepattributes Signature
    -keep class sun.misc.Unsafe { *; }
    
    0 讨论(0)
  • 2021-01-19 06:22

    In addition to Jake's answer, this is what I had to add to my proguard file to get it to work correctly:

    -keep class com.google.gson.** { *; }
    -keep class com.google.inject.** { *; }
    -keep class org.apache.http.** { *; }
    -keep class org.apache.james.mime4j.** { *; }
    -keep class javax.inject.** { *; }
    -keep class retrofit.** { *; }
    
    0 讨论(0)
提交回复
热议问题