I have multiple classes in my application that provide public static void main(String[] args)
methods. These methods are only required during development / testing, and I'd like ProGuard to remove them (but only these methods, not the entire surrounding classes). I've tried to use -assumenosideeffects
, but that only seems to affect calls to methods, not the methods themselves. How can I force Proguard to remove the entire main()
methods despite them being public
and static
?
ProGuard needs seeds to determine which classes/methods need to be kept. Anything referenced from these seeds will also be kept.
The -assumenosideeffects
option is used to remove actual calls to methods whose result is not used in any way, but does not necessarily mean that the method itself is removed.
In your specific case, you probably have a rule that keeps all public static void main(String[])
methods as this would be the standard seed for a java application.
You can analyse the reason why a specific method/class is kept using the -whyareyoukeeping
option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With