简体   繁体   中英

Avoid direct translation of “public static final” with ProGuard

How can i tell to ProGuard not to do this?

In Class A
  Toast.makeText(getApplicationContext(), Utility.NO_SESSION, 0).show();
-> with ProGuard  <--
  Toast.makeText(getApplicationContext(), "Please login", 0).show();

In Class Utility
  public static final String NO_SESSION = "Please login";
-> with ProGuard  <--
  this string does not even exist

This just makes things easier to read

It really makes no difference to someone trying to read reverse engineered code whether they have to look up a constant or it's inline.

But if you like you can add:

-keep class your.package.Utility { public static *; }

To your proguard-project.txt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM