How to check if the running application is minimized by Proguard in runtime in non Android project?

In non Android project (Desktop)

I was already able to use Proguard with Kotlin/JVM.

Is there a way to check if the running application is minimized/shirked/optimized or modified by Proguard in general? Regarding if it’s obfuscated in a generic way

The Proguard folder will be included in META-INF even if the JAR is not a Proguard JAR, the reason I’m interested in this because I had an error with a library because it uses reflections and was unable to solve it.

In my use case, I provided the Far JAR and the Minimized JAR for the users, I will provide an alternative solution for the Minimized JAR as a workaround but not sure how to check if the current application/JAR is minimized by Proguard in runtime.

Is the only way to generate code when running a Proguard task?

Thank you.

1 Like

Hello @AhHne1 :wave: :wave:

You can use representation and realtime checks together to find out if proguard is minimising an application that is executing in a non android project. First; make sure your class names and methods have been hidden by proguard. Use Java Reflection at runtime to examine the application current state. Create a function that handles possible class not found exception conditions by attempting to reach hidden classes and techniques. Should these exceptions be identified; proguard has certainly hidden and deleted the code; suggesting that the application could be cut previously or changed.