Using GSON with proguard enabled

Variable names will be obfuscated with proguard, leaving you with something like private String a; Instead of private String descripcionCategoria; You can add proguard rules so some classes don’t get obfuscated. I got away with it using these: -keepattributes Signature # POJOs used with GSON # The variable names are JSON key values and should … Read more

proguard Missing type parameter

answer is: use this proguard.cfg ##—————Begin: proguard configuration common for all Android apps ———- -optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers -dontpreverify -verbose -dump class_files.txt -printseeds seeds.txt -printusage unused.txt -printmapping mapping.txt -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* -allowaccessmodification -keepattributes *Annotation* -renamesourcefileattribute SourceFile -keepattributes SourceFile,LineNumberTable -repackageclasses ” -keep public class * extends android.app.Activity -keep public class * extends android.app.Application -keep public class … Read more

Proguard ignores config file of library

You typically should not enable ProGuard in the library project. ProGuard processes the application and the library together in the application project, which is the most effective approach. In the library project, you can specify any library-specific ProGuard configuration in build.gradle, e.g.: defaultConfig { consumerProguardFiles ‘proguard-rules.txt’ } This file is then packaged in the library … Read more

ProGuard: can’t find referenced class com.google.android.gms.R

Although adding this to proguard-project.txt file works, it keeps all classes. -keep class com.google.android.gms.** { *; } -dontwarn com.google.android.gms.** I prefer this, which makes apk file size much smaller: -keep public class com.google.android.gms.* { public *; } -dontwarn com.google.android.gms.** Also note up to date Google Play Proguard notification here: http://developer.android.com/google/play-services/setup.html#Proguard -keep class * extends java.util.ListResourceBundle … Read more

proguard hell – can’t find referenced class

org.simpleframework.xml.stream.StreamReader in your code refers to javax.xml.stream.events.XMLEvent. The latter class is part of the Java runtime (rt.jar) but not part of the Android runtime (android.jar), so ProGuard warns that something might be broken. If you’re sure that your application works anyway, you can specify -dontwarn javax.xml.stream.events.** ProGuard hell?