The optimization step of ProGuard can be switched off with the
-dontoptimize option. For
more fine-grained control over individual optimizations, experts can use the
-optimizations option,
with a filter based on the optimization names listed below. The filter works
like any filter in ProGuard.
The following wildcards are supported:
?
matches any single character in an optimization name.
*
matches any part of an optimization name.
An optimization that is preceded by an exclamation mark '!' is
excluded from further attempts to match with subsequent
optimization names in the filter. Make sure to specify filters correctly,
since they are not checked for potential typos.
For example,
"code/simplification/variable,code/simplification/arithmetic"
only performs the two specified peephole optimizations.
For example, "!method/propagation/*" performs all optimizations,
except the ones that propagate values between methods.
For example,
"!code/simplification/advanced,code/simplification/*" only
performs all peephole optimizations.
Some optimizations necessarily imply other optimizations. These are then
indicated. Note that the list is likely to change over time, as optimizations
are added and reorganized.
class/marking/final
Marks classes as final, whenever possible.
class/merging/vertical
Merges classes vertically in the class hierarchy, whenever possible.
class/merging/horizontal
Merges classes horizontally in the class hierarchy, whenever possible.
(⇒ code/removal/advanced)
field/removal/writeonly
Removes write-only fields.
field/marking/private
Marks fields as private, whenever possible.
(⇒ code/simplification/advanced)
field/propagation/value
Propagates the values of fields across methods.
method/marking/private
Marks methods as private, whenever possible (devirtualization).
(⇒ code/removal/advanced)
method/marking/static
Marks methods as static, whenever possible (devirtualization).
method/marking/final
Marks methods as final, whenever possible.
(⇒ code/removal/advanced)
method/removal/parameter
Removes unused method parameters.
(⇒ code/simplification/advanced)
method/propagation/parameter
Propagates the values of method parameters from method invocations to
the invoked methods.
(⇒ code/simplification/advanced)
method/propagation/returnvalue
Propagates the values of method return values from methods to their
invocations.