4

In the proguard-rules.pro file, does the order of the statements matter? For example, more broad to more specific:

# Class names are needed in reflection
-keepnames class com.amazonaws.**
-keepnames class com.amazon.**
# This is a big hammer to fix "unable to marshall response" errors.
-keep class com.amazonaws.services.cognitoidentityprovider.** { *; }
# Request handlers defined in request.handlers
-keep class com.amazonaws.services.**.*Handler

versus, more specific to more broad:

# This is a big hammer to fix "unable to marshall response" errors.
-keep class com.amazonaws.services.cognitoidentityprovider.** { *; }
# Request handlers defined in request.handlers
-keep class com.amazonaws.services.**.*Handler
# Class names are needed in reflection
-keepnames class com.amazonaws.**
-keepnames class com.amazon.**

Does the order of the -keep statements affect the way Proguard processes the file?

In addition to that, what about when two -keep* directives cover the same class? Which one takes effect, the first declared in the rules file, or the more specific rule?

For example:

-keepnames class com.amazonaws.**
-keep class com.amazonaws.services.cognitoidentityprovider.** { *; }

The second rule specifies a subset of the first rule, but the second rule is a more restrictive rule (-keep vs. -keepnames). Which of those statements will effect the subset of namespace?

anro
  • 195
  • 9
  • I'd like to know too, did you find out anything in the meantime? – DerDingens Nov 12 '19 at 08:07
  • For the first part, see https://stackoverflow.com/questions/56272481/does-the-order-of-rules-in-proguard-rules-pro-matter - currently the two answers are a claimed "no" and an implied "yes". Not sure about the order of precedence for overlapping rules though. – Rob Oxspring Feb 10 '23 at 11:42

0 Answers0