Obsolete proguard file; use -keepclasseswithmember

2020-05-30 03:04发布

问题:

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

回答1:

Try with

Clean and build your project then select the error marker in the Problems view and press Delete.

see the following link

http://groups.google.com/group/android-developers/browse_thread/thread/7606320e664fec9b



回答2:

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 *;
}