I’ve spent so much time trying to shrink my jar file with Proguard and had no success so far.
Asked this question on GitHub but project admins directed me here.
The original jar file is attached. It is for this open-source application and works without any problem (at least on my machine).
I just want to reduce its size, not obfuscate it.
I used the following configuration.
Any help appreciated.
-injars 'theApp.jar'
-outjars 'out.jar'
-libraryjars 'path\to\jdk-11\jmods'(!**.jar;!module-info.class)
-dontskipnonpubliclibraryclassmembers
-forceprocessing
-dontoptimize
-dontobfuscate
-dontusemixedcaseclassnames
-keepattributes Exceptions,SourceFile,LineNumberTable,*Annotation*,Signature,EnclosingMethod,InnerClasses
-verbose
-keepkotlinmetadata
-dontnote kotlin.internal.PlatformImplementationsKt,kotlin.reflect.jvm.internal.**
-keep class kotlin.Metadata {
<fields>;
<methods>;
}
-keepclasseswithmembernames,includedescriptorclasses class * {
native <methods>;
}
# Keep names of fields marked with @FXML attribute
-keepclassmembers class * {
@javafx.fxml.FXML
<fields>;
@javafx.fxml.FXML
<methods>;
}
-keep class com.sun.javafx.tk.quantum.QuantumToolkit
-keep class ir.mahozad.donim**{
<fields>;
<methods>;
}
# Keep - Applications. Keep all application classes, along with their 'main' methods.
-keepclasseswithmembers public class com.javafx.main.*,ir.mahozad.donim.* {
public *; public static *;
}
# Also keep - Enumerations. Keep the special static methods that are required in
# enumeration classes.
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
# Also keep - Database drivers. Keep all implementations of java.sql.Driver.
-keep class * extends java.sql.Driver
# Also keep - Swing UI L&F. Keep all extensions of javax.swing.plaf.ComponentUI,
# along with the special 'createUI' method.
-keep class * extends javax.swing.plaf.ComponentUI {
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent);
}
# Keep - Native method names. Keep all native class/method names.
-keepclasseswithmembers,includedescriptorclasses,allowshrinking class * {
native <methods>;
}