Retrofit illegalargumentexception, no annotation found

五迷三道 提交于 2020-01-17 09:03:45

问题


So when running my app I'm getting this error:

06-17 12:56:08.547 E/AndroidRuntime(23432): Caused by: java.lang.IllegalArgumentException: XapoService.credit: No Retrofit annotation found. (parameter #1)

I have Google searches and found it may be caused by ProGuard. I added the following lines to my ProGuard:

-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 java.io.** { *; }
-dontwarn retrofit.**
-keep class retrofit.** { *; }
-keepattributes Signature
-keepattributes Exceptions
-keepattributes *Annotation*
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.**
-keep interface retrofit.** { *; }
-dontwarn rx.**
-keepclasseswithmembers class * {
@retrofit.http.* <methods>
}
    -keep class com.google.common.** { *; }
    -keep class com.mycompany.testSDK.XapoService { ; }

Yet I am still receiving the error at this call:

import retrofit.client.Response;
import retrofit.http.GET;
import retrofit.http.Query;
import java.util.List;



public interface XapoService {
    @GET("/credit/")
    Response credit(@Query("appID") String appID, @Query("hash") String hash);
}

回答1:


SDK was updated today for Android. Solved.



来源:https://stackoverflow.com/questions/30898350/retrofit-illegalargumentexception-no-annotation-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!