2014-11-24 28 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