If you use ProGuard for obfuscating your code and happen to use Retrofit in your application, you will need to configure ProGuard to exclude certain Retrofit files from being obfuscated. Also you must note that if you are using GSON for conversion from JSON to POJO representation, you must ignore those POJO classes from being obfuscated, this is required as if those POJO class field names are obfuscated, conversion to POJO’s from JSON would fail because POJO field names are inferred from JSON response. So to keep it brief you should use the following configuration.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | -keep class com.squareup.** { *; } -keep interface com.squareup.** { *; } -dontwarn com.squareup.okhttp.** -keep class retrofit.** { *; } -keepclasseswithmembers class * { @retrofit.http.* <methods>; } -keep interface retrofit.** { *;} -keep interface com.squareup.** { *; } -dontwarn rx.** -dontwarn retrofit.** #Here include the POJO's that have you have created for mapping JSON response to POJO for example com.blogspot.ramannanda.apps.xyz.FeedlyResponse {*;} |
Here FeedlyResponse is just a POJO class that maps to JSON fields returned by Feedly feed search API.
Go Top
comments powered by Disqus