Cheok Yan Cheng
Cheok Yan Cheng

Reputation: 42786

What is the difference between -keep and -keepclassmembers in ProGuard?

I read through http://proguard.sourceforge.net/index.html#manual/usage.html but cannot get their differences.

I tested with 2 different options and decompiled the outcome. Both seems to produce the same result.

-keep class * implements android.os.Parcelable {
    *;
}

-keepclassmembers class * implements android.os.Parcelable {
    *;
}

Upvotes: 30

Views: 15412

Answers (1)

user1592811
user1592811

Reputation: 913

The first (-keep) will keep classes and class members that implement android.os.Parcelable from being removed or renamed.

The latter (-keepclassmembers) will keep class members only of classes that implement android.os.Parcelable from being removed or renamed.

Upvotes: 40

Related Questions