Obsolete proguard file; use -keepclasseswithmembers instead of -keepclasseswithmembernames

Khawar Raza picture Khawar Raza · Dec 23, 2011 · Viewed 12.2k times · Source

I am having the following error on proguard.cfg file in my android project. I dont know what this error says. Any idea?

Answer

silvermouse picture silvermouse · May 10, 2012

This is a bug with the SDK tools v11. http://code.google.com/p/android/issues/detail?id=16384

When Lint generates error,

  • go to lint warnings view (Window > Show View > Other > android > Lint Warnings) and double click the error to modify proguard.cfg

  • rename "keepclasseswithmembernames" to "keepclasseswithmembers" on line it shows error and save.

  • run Lint again (click refresh in Lint Warnings view)

  • repeat renaming if it shows further warnings in subsequent lines.

I changed mine to look like this.

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}