A story about exporting a javaFX project and trying to obfuscate the created jar file. From the conclusion, the cause was that the annotation disappeared when obfuscated by proguard. As a countermeasure, I first tried to obfuscate with the following settings that do nothing.
#sample.pro
#Setting to do nothing
-injars 'C:\******\input.jar'
-outjars 'C:\******\output.jar'
#External jar
-libraryjars 'C:\Program Files\Java\jdk1.8.0_144\jre\lib\rt.jar'
-libraryjars 'C:\****\*****.jar'
-libraryjars 'C:\****\*****.jar'
#Attribute setting
-keepattributes *Annotation*, Signature, Exceptions, InnerClass
#Class setting
-keep class * {
*;
}
If this doesn't work, the jar file settings may be incorrect. If it works, remove the obfuscated part from here. For example, classify each package as shown below and set each individually.
$sample2.pro
#Individual settings for each package
-injars 'C:\******\input.jar'
-outjars 'C:\******\output.jar'
#External jar
-libraryjars 'C:\Program Files\Java\jdk1.8.0_144\jre\lib\rt.jar'
-libraryjars 'C:\****\*****.jar'
-libraryjars 'C:\****\*****.jar'
#Attribute setting
-keepattributes *Annotation*, Signature, Exceptions, InnerClass
#Class setting
-keep class package1.* { *;}
-keep class package2.* { *;}
-keep class package3.* { *;}
-keep class package4.* { *;}
Recommended Posts