Protections
String protection
Keep text out of the file in plain form.
Setting: protection.strings, with four levels. This protects every string literal in your code — error messages, URLs, keys, anything written as text in your source — so none of it appears as plain, searchable text in the output jar.
Levels
| Level | Name | What it does |
|---|---|---|
| 0 | Off | Strings are left as-is. |
| 1 | Standard | Each string is decrypted every time it's used. |
| 2 | Cached | Each string is decrypted once per call site, then reused — faster if the same string is read often. |
| 3 | Native | Decryption happens through native protection, if that's also turned on; otherwise this behaves the same as Standard. |
Every string gets its own key rather than sharing one key across the whole program, so finding one string's key doesn't help find the rest.
Pooling
Setting: protection.stringPooling. Requires string protection to be on. Instead of decrypting each string right where it's used, this groups a class's strings into one lookup table. Turn this on if you have a lot of repeated or similar strings and want a smaller file.
Choosing strings per method
You can override the project-wide level for a specific method or class with an annotation — see Annotations for @StringsStandard, @StringsCached, and @StringsNative.