语句顺序重要/在Proguard中是否优先?

时间:2019-04-12 09:04:38

标签: proguard android-proguard

在proguard-rules.pro文件中,语句的顺序重要吗? 例如,从更广泛到更具体:

# 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

相对,更广泛更具体:

# 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.**

-keep语句的顺序是否会影响Proguard处理文件的方式?

除此之外,当两个-keep *指令覆盖同一类时,该怎么办?哪个生效,是规则文件中第一个声明的规则,还是更具体的规则?

例如:

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

第二条规则指定了第一条规则的子集,但是第二条规则是限制性更强的规则(-keep与-keepnames)。这些语句中的哪一条会影响名称空间的子集?

0 个答案:

没有答案