ProGuard Cannot Find Referenced Libraries

Made a few changes to proguard-project.txt file (if you have more than one module in your project – put it in the module which calls the *.jar file you are getting warned about): -keepattributes SourceFile,LineNumberTable -keep class com.parse.*{ *; } -dontwarn com.parse.** -dontwarn com.squareup.picasso.** -keepclasseswithmembernames class * { native <methods>; } The -dontwarn lines were … Read more

When obfuscating with ProGuard, does -keepattributes SourceFile,LineNumberTable make the resulting apk easier to reverse engineer?

ProGuard manual > Examples > Producing useful obfuscated stack traces The SourceFile attribute is required, because Oracle/Sun’s Java virtual machine otherwise does not include line numbers in stack traces, which is what you really want (and which is quite harmless on its own). I haven’t checked if this is true for Android’s Dalvik virtual machine. … Read more

ProGuard configuration for Guava with obfuscation and optimization

As of Guava 17.0, this is what I needed in ProGuard config: -dontwarn javax.annotation.** -dontwarn javax.inject.** -dontwarn sun.misc.Unsafe Otherwise build fails with warnings like: Warning: com.google.common.base.Absent: can’t find referenced class javax.annotation.Nullable (That’s because Guava uses annotations that are not part of Android runtime (android.jar). In this case it’s fine to just mute the warnings.) If … Read more

Android Proguard Javascript Interface Fail

If MyJavaScriptInterface is an inner class of MyClass, ProGuard expects a fully qualified name com.mypackage.MyClass$MyJavaScriptInterface. The naming convention with $ is used in the compiled class files on which ProGuard operates. Note that ProGuard mentions class names in the configuration that it can’t find in the input jar, suggesting that these names may have been … Read more

Proguard warnings “can’t write resource [META-INF/MANIFEST.MF] (Duplicate zip entry)”

Possibly a ‘proguard.cfg’ problem. Does it include any ‘-injars’? If your project includes another project as a library, jars can be processed twice. Could you post your ‘proguard.cfg’? Extract from http://proguard.sourceforge.net/index.html#manual/troubleshooting.html: Your input jars contain multiple resource files with the same name. ProGuard continues copying the resource files as usual, skipping any files with previously … Read more

Proguard and reflection in Android

SOLVED For others that are having this problem you need to add the following to proguard.cnf -keep public class * extends com.yoursite.android.yourappname.YourClassName -keepclassmembers class * extends com.yoursite.android.yourappname.YourClassName{ public <init>(android.content.Context); } The first keep tells proguard to not obfuscate class names that extend YourClassName The second one says to keep the constructor name (<init> means constructor) … Read more