ProGuard Pro Tips
With my launch of Proton, I decided to incorporate the recently released License Verification Library (LVL), which is meant to improve security of Android apps by adding a licensing layer to help ensure you’re running an app legally.
Google’s own documentation for the LVL notes code obfuscation is strongly recommended. What they don’t mention are the specific ProGuard settings (or any other Java obfuscator, for that matter) to use when LVL is in place. The default ProGuard configuration example will cause your app to force quit with an enumeration related exception.
The only documentation online that deals with the LVL/ProGuard combination is a lot of people complaining about their apps crashing after obfuscation. Not very helpful.
After much time spent tweaking settings, and searching for solutions, I found a combination that works without causing any force quits or license verification errors.
Add the following to your ProGuard configuration:
-keep class com.android.vending.licensing.ILicensingService -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }
The main problem lay with allowing ProGuard touch enumerations (as noted in documentation I can’t easily link to). A secondary issue was a missing entry point to the LVL service.
The enumeration fix may also be of use if you’re experiencing problems with ProGuard and not using the License Verification Library. Your mileage may vary. Document any further related problems or fixes in the comments.
With all of the above said, I’m still not sure LVL is quite mature enough to rely on yet. Unless I’m just doing it wrong.