We are developing a desktop application. When running ProGuard (version 5.3.3) on the code using the following configuration flags:
-dontoptimize
-allowacces
Troubleshooting
ProGuard may print out some notes and non-fatal warnings:
Note: can't find dynamically referenced class ProGuard can't find a class or interface that your code is accessing by means of introspection. You should check if you want to add the jar that contains this class.
Note: ... calls '(...)Class.forName(variable).newInstance()'
ProGuard lists all class casts of dynamically created class instances, like "(MyClass)Class.forName(variable).newInstance()". Depending on your application, you may need to keep the mentioned classes with an option like -keep class MyClass
, or their implementations with an option like -keep class * implements MyClass
. You can switch off these notes by specifying the -dontnote
option.
Note: ... accesses a field/method '...' dynamically
ProGuard lists a number of constructs like ".getField("myField")". Depending on your application, you may need to figure out where the mentioned class members are defined and keep them with an option like -keep class MyClass { MyFieldType myField; }
. Otherwise, ProGuard might remove or obfuscate the class members, since it can't know which ones they are exactly. It does list possible candidates, for your information. You can switch off these notes by specifying the -dontnote
option.
manual/troubleshooting As a final solution, you could switch off optimization (-dontoptimize) and preverification (-dontpreverify).
Initialization, verification, and validation are part of the building project. I believe flag -allowaccessmodification
is to allow modification when building the project (i.e. your classes are modified from the original structure). When original class structure gets modified then their stack frames are disturbed. This leads to verification failure. If you want to ignore the verify error then as mentioned you need to use the flag that suspends verification.
You're specifying the option -dontwarn to suppress warnings about unresolved references. This can lead to problems while processing the code. ProGuard needs those references, e.g. in the preverification step. The error indeed suggests that the input doesn't contain all necessary dependencies: some common superclass or interface of ImmutableList
and UnmodifiableIterator
is missing. For a desktop application, you should check that you're specifying a Java runtime jar with all the necessary classes:
-libraryjars <java.home>/lib/rt.jar
See the ProGuard manual > Troubleshooting > Warning: can't find superclass or interface