This question might be marked as duplicated but I spent days searching all over the internet and I couldn’t understand how I can use it to reduce the jar file size and I already saw many questions like this (the issue from my side)
Let’s say you want to make a very lightweight script in Kotlin/JVM and ship it as jar, and you want to use some dependencies so you will want to use something like Shadow jar Gradle plugin to include the dependencies sinde the default jar task wouldn’t, shadow jar already have minimize option but it doesn’t do much as it’s not designed for that,1.6MB for a hello world program that use zero imports is a little bit overkill
All I know proguard is a tool designed primarily for reducing the jar and do other similar tasks
Adding proguard gradle task along with the plugin as build task, defining in and out jar
But when running the proguard task it says I should solve the warrnings but doesn’t provide any warrings, running the task with --info
will make the log very long and still can’t understand what’s wrong, searching on Stackoverflow answers says I should add ignore warrnings in the proguard-rules.pro
which doesn’t sound like a solution to me but I tried anyway
After that I get different error says I should define steps for what to keep
I don’t understand this, Proguard is designed for detecting what is used and what is not automatically but sometimes you should define what to keep and what to not because of reflection for example
But shouldn’t choosing what to keep and what to not is optional??
I didn’t quite understand how it work and searched from many places and used the rules template and doesn’t seems to work regarding of what I do, one template worked but I’m getting error says ClassNotFound Exception for MainKt
On Android projects we rarely have to deal with this file, I just want to get started and using proguard on hello world in Kotlin to reduce the 1.6MB with no imports but still include many things like kotlin collections
There are other tools like shakyboi and did just that with minimal configurations but is more experimental and unfinished and doesn’t reduce much as the project grow but did incredible jar file size reduce for hello world program from 1.6MB to about kilobytes
I appreciate your work and help on proguard but I really want to try it out correctly, and I just want to get started with minimal configurations in Kotlin/JVM for hello world program
Then I would start adding dependencies and more code and functionalities
Thank you