Without Proguard enabled, retrofit2 work properly... but when enabled, application crash...
Here is my Proguard rules:
-dontwarn retrofit2.Platform$Java8
-dontwarn okio.**
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions
-keepattributes *Annotation*
-keepattributes RuntimeVisibleAnnotations
-keepattributes RuntimeInvisibleAnnotations
-keepattributes RuntimeVisibleParameterAnnotations
-keepattributes RuntimeInvisibleParameterAnnotations
-keepattributes EnclosingMethod
-keepclasseswithmembers class * {
@retrofit2.* <methods>;
}
-keepclasseswithmembers interface * {
@retrofit2.* <methods>;
}
-keepclassmembers class demirci.omer.butun.gazeteler.siteler.newspapers.data.model.** { <fields>; }
-keep class demirci.omer.butun.gazeteler.siteler.newspapers.data.model.** { <fields>; }
-keep class demirci.omer.butun.gazeteler.siteler.newspapers.data.ApiEndPoint { <fields>; }
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }
-keep class retrofit2.converter.gson.** { *; }
I have read below question: retrofit2 rule
But I have also use retrofit2 converter with POJO. I think problem occur with this...Found this question: gson-converter
There is two contidion for where problem occur.
Retrofit2 proguard rules is not suitable Or Retrofit2 converter GSON with POJO is not convert data if fields obfuscated
I dont know with which condition problem occur...
here is my api interface:
public interface ApiEndPoint {
@FormUrlEncoded
@POST("all_newspaper/get_text.php")
Call<NewsContentClass> getContent(@Field("url") String url);
@FormUrlEncoded
@POST("all_newspaper/add_user_url.php")
Call<Void> addUserUrl(@Field("app_name") String appName,@Field("mobile_url") String mobile_url,@Field("desktop_url") String desktop_url);
}