Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Obsolete proguard file; use -keepclasseswithmembers instead of -keepclasseswithmembernames

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

like image 431
Khawar Raza Avatar asked Dec 23 '11 06:12

Khawar Raza


People also ask

Should I use R8 or ProGuard?

R8 is having a faster processing time than Proguard which reduces build time. R8 gives better output results than Proguard. R8 reduces the app size by 10 % whereas Proguard reduces app size by 8.5 %. The android app having a Gradle plugin above 3.4.

Is ProGuard deprecated?

For example, the useProGuard setting has been deprecated a while ago - maybe that's what you saw and you're misremembering it.

What is ProGuard mapping file?

A mapping file contains the original names and the obfuscated names of classes, fields, and methods. ProGuard can write out such a file while obfuscating an application or a library, with the option -printmapping . ReTrace requires the mapping file to restore obfuscated stack traces to more readable versions.


2 Answers

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 *; } 
like image 98
silvermouse Avatar answered Oct 04 '22 14:10

silvermouse


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

like image 31
Sunil Kumar Sahoo Avatar answered Oct 04 '22 14:10

Sunil Kumar Sahoo