I am not very familiar with proguard, I want to obfuscate a JavaFX application, I already did it right but now after adding some changes to the project things screwed up.
Here is my .pro configuration file :
-injars ../INJAR.jar
-outjars ../OUTJAR.jar
-libraryjars 'rt.jar'
-libraryjars 'jce.jar'
-libraryjars 'jfxrt.jar'
-dontshrink
-dontoptimize
-flattenpackagehierarchy ''
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,*Annotation*,Synthetic,EnclosingMethod
-adaptresourcefilecontents **.fxml,**.properties,META-INF/MANIFEST.MF
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-keep class javax.** { *; }
-keep class impl.** { *; }
-dontwarn impl.**
-keep class org.** { *; }
-dontwarn org.**
-keepclasseswithmembers public class main.Main {
public static void main(java.lang.String[]);
}
-keepclassmembernames class * {
@javafx.fxml.FXML *;
}
-keepclassmembernames class main.*Controller {
public <methods>;
public <fields>;
}
-keepclassmembernames class main.NewApplicationController$Applicant {
public <methods>;
public <fields>;
}
-keepclassmembernames class main.RDVTaker {
public <methods>;
}
-obfuscationdictionary members.txt
-classobfuscationdictionary classes.txt
-printmapping mapping.txt
by executing the command :
java -jar obf_data/proguard.jar @obf_data/myconfig.pro > obf_data/info.txt
I get this erro :
Error: Unexpected error while writing class [oshi/hardware/platform/mac/MacDisks] (Overflow of unsigned short value [70168])
I bypassed the above error by removing -dontshrink
option, but in this case the resulting jar is raising the following error : Error: Invalid or corrupt jarfile OUTJAR.jar
And by removing both -dontshrink
and -dontoptimize
another error get raised, a stacktarce is printed, but I found out that the error was described at this level of stack :
Caused by: javafx.fxml.LoadException:
file:/C:/Users/younes/IdeaProjects/vpro/out/artifacts/vpro/OUTJAR.jar.
jar!/main/main.fxml:12
I am wondering if someone got a supposition, idea or even another obfuscating tool,
Thanks in advance
For some reason the file wasn't present in the OUT file, I worked it around by manually injecting it in the jar zip. Some flags of Proguard may help to keep the file.