0

I am wondering what does this do:

-keepclassmembers class * {
    private <fields>;
}

Will this rule actually prevent the all classes from being obfuscated?

JayVDiyk
  • 4,277
  • 22
  • 70
  • 135

1 Answers1

1

According to the documentation -keepclassmembers rule does this:

Specifies class members to be preserved, if their classes are preserved as well.

In this case it means that all private fields in any class that survives shrinking phase will be kept.

This rule doesn't prevent classes from being stripped away or being obfuscated. It only prevents private fields of kept classes from being stripped away or being obfuscated.

Update:

It might be a little confusing what class * matches. One * normally matches any part of a class name not containing the package separator. However in this case it matches any class. The documentation says:

For convenience and for backward compatibility, the class name * refers to any class, irrespective of its package.

Tomik
  • 23,857
  • 8
  • 121
  • 100