When you are deploying a Luciad portfolio-based application, you are required to obfuscate the Luciad portfolio libraries with ProGuard.

As this is an intricate process, you can already take some precautions to prevent potential glitches before you start obfuscating. If you still run into problems despite those precautions, you can find a couple of suggestions for solutions in this article as well.

How to prevent obfuscation problems

Obfuscation is quite a complex process that involves re-writing the class files. We try to make the process as hassle-free as possible by shipping a tested sample Proguard configuration for you to use.

By respecting these two simple rules, you can prevent most obfuscation-related problems:

  • Always use the latest version of ProGuard.

  • When you upgrade to a newer version of your Luciad portfolio product, make sure to upgrade your ProGuard configuration as well. Take notice of any changes made to the product’s sample configuration.

If you still encounter problems during or after obfuscation, check if the issue can be attributed to one of the causes below before you contact the Luciad Support Desk Services.

How to resolve obfuscation problems

Check the solutions to some of the possible issues with ProGuard obfuscation.

Get more information

Do not use the -dontwarn option in your ProGuard configuration. If you leave out this option, ProGuard will print warnings for problems that occurred during the obfuscation process. These may already give you a clue about possible solutions.

The log of warnings will also be of help if you still have to get in touch with the Luciad Support Desk Services.

Library jar implements program jar

Cause

You may have incorrectly split -injars and -libraryjars.

Solution

Make sure that:

  • All Luciad JARs (the JARs with an lcd_ prefix) and your application JARs are marked as -injar

  • All third-party JARs are marked as -libraryjar. Java’s rt.jar and jce.jar must both be specified as libraryjar.

Verifyerror

Cause

This is most likely caused by turning off the pre-verification option in Proguard. As of Java 7, pre-verification is required or your application will not run.

Solution

Make sure that the -dontpreverify option doesn’t appear anywhere in your ProGuard configuration.

Other errors

Errors caused by ProGuard tend to be non-specific and can have various causes. Some of the most likely causes are listed here.

  • Possible cause: Mixing obfuscated and non-obfuscated versions of the same JAR(s).
    Solution: Verify that the classpath only contains the obfuscated JARs.

  • Possible cause: ProGuard optimization is enabled.
    Solution: ProGuard optimization occasionally causes problems. It’s recommended to disable it with -dontoptimize.

  • Possible cause: rt.jar and jce.jar were not specified as -libraryjar.
    Solution: Make sure that both rt.jar and jce.jar are specified.