2016-08-24 52 views
0

在我的應用程序中,我使用了retrofit 2進行網絡通信。 我有一個serverAPI接口包含例如每個API請求:DexGuard 7和Retrofit 2錯誤

@Multipart 
@POST(V2__ACCOUNT__UPLOAD_AVATAR) 
Call<UploadAvatarResponse> uploadAvatar(@PartMap Map<String, RequestBody> params); 

我用Dexguard 09年2月7日混淆我的應用程序,每一個網絡通信正在期待一個!

我真的不知道什麼是錯的。

我在調試器中看到,當應用程序調用此請求時,代碼跳轉到onFailure()方法,但應用程序不會將請求發送到服務器。

如果我不混淆應用程序一切工作正常。

回答

0

當你使用的回調,則可能需要增加以下內容:

-keepattributes Exceptions 
+0

我加了但是對我沒幫助 – just

0

如果您使用Proguard的在你的項目中添加以下行到您的配置:

# Platform calls Class.forName on types which do not exist on Android to determine platform. 
-dontnote retrofit2.Platform 
# Platform used when running on RoboVM on iOS. Will not be used at runtime. 
-dontnote retrofit2.Platform$IOS$MainThreadExecutor 
# Platform used when running on Java 8 VMs. Will not be used at runtime. 
-dontwarn retrofit2.Platform$Java8 
# Retain generic type information for use by reflection by converters and adapters. 
-keepattributes Signature 
# Retain declared checked exceptions for use by a Proxy instance. 
-keepattributes Exceptions 

來源: http://square.github.io/retrofit/

+0

我加了但是對我沒有幫助 – just