icepick icon indicating copy to clipboard operation
icepick copied to clipboard

Proguard issues with code obfuscation

Open ouyangzn opened this issue 7 years ago • 2 comments

Hi guys, there is a problem, if i add this line, all class name will not be obfuscated, it seems not so well. How can i resolve it?

-keepnames class * { @icepick.State *;}

ouyangzn avatar Mar 22 '17 03:03 ouyangzn

This rule seems to be unnecessary and wrong. If I understand ProGuard docs correctly this rule means "Keep names of all classes that were not removed AND ALSO keep names of members that are annotated with @State.

I removed this rule, so now I have:

-dontwarn icepick.**
-keep class icepick.** { *; }
-keep class **$$Icepick { *; }

-keepclasseswithmembernames class * {
    @icepick.* <fields>;
}

State restoration works, this seems to be the right set of rules. Unobvious thing here is that rule

-keepclasseswithmembernames class * {
    @icepick.* <fields>;
}

Won't work without -keep class icepick.** { *; } because @icepick.* annotations are removed.

pamalyshev avatar Mar 29 '17 09:03 pamalyshev

I spent a few hours today investigating this issue before I found this topic. So I created a pull request to remove the line from README and avoid the pain to others.

phcannesson avatar Jan 25 '18 15:01 phcannesson