2014-11-24 27 views
0

当我运行启用了proguard的应用程序时,@QueryMap查询字符串不会被追加到主URL。 接口功能:使用proguard改装@QueryMap

@GET(PATH_HEADER + "/function/") 
ServiceLoginResponse function(@QueryMap Map options); 

随着日志启用,使用ProGuard,这是请求:

com.app D/Retrofit﹕ ---> HTTP GET https://domain.com/json/function/ 
com.app D/Retrofit﹕ Cache-Control: public, max-age=600 
com.app D/Retrofit﹕ ---> END HTTP (no body) 

没有proguard的:

com.app D/Retrofit﹕ ---> HTTP GET https://domain.com/json/function/?param1=val1&param2=val2 
com.app D/Retrofit﹕ Cache-Control: public, max-age=600 
com.app D/Retrofit﹕ ---> END HTTP (no body) 

在我Proguard的规则文件我有这个;

-keep class retrofit.** { *; } 

回答

2

对于改造您需要保留注释。对于添加此规则:

-keepattributes *Annotation* 

然后,你需要你的规则是保留改造类:

-keep class retrofit.** { *; } 

而且你可能需要保持你的REST API及其API方法:

-keepclasseswithmembers class * { 
    @retrofit.http.* <methods>; 
} 
+0

像魅力一样工作,非常感谢:) – 2014-11-25 09:12:37