我使用Proguard 4.8
混淆了我的javafx应用程序jar,而混淆的jar正在显示jar中缺少的一些类。缺少的类是FXML的所有控制器类。在build.xml
中使用额外的两个实用程序jar混淆应用程序JAR的这一步有什么问题?
<target name="Ofuscating" depends="CreatingJars" >
<taskdef resource="proguard/ant/task.properties" classpath="${WorkingFolder}/proguard.jar" />
<proguard>
-dontusemixedcaseclassnames
-printmapping proguard.map
-dontshrink
-dontoptimize
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
<!--flattenpackagehierarchy ''-->
-libraryjars "${java.home}/lib/rt.jar"
-libraryjars "${java.home}/lib/javaws.jar"
-libraryjars "${env.JAVA_HOME}/lib/ant-javafx.jar"
-libraryjars "${env.JREFX_HOME}/lib/jfxrt.jar"
-libraryjars ${WorkingFolder}/libs/BareBonesBrowserLaunch.jar
:
:
-libraryjars ${WorkingFolder}/CustomJars/Lib.jar
-injars ${WorkingFolder}/${app.name}.jar
-injars ${WorkingFolder}/CustomJars/Verifier.jar(!META-INF/MANIFEST.MF)
-injars ${WorkingFolder}/CustomJars/Utility.jar(!META-INF/MANIFEST.MF)
-outjars ${WorkingFolder}/Obfuscated.jar
-ignorewarnings
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,LocalVariable*Table,*Annotation*,Synthetic,EnclosingMethod
-adaptresourcefilecontents **.fxml,**.properties,META-INF/MANIFEST.MF,images/*.jar,publicCerts.store,production.version
-keepclassmembernames class * {
@javafx.fxml.FXML *;
}
-keepclasseswithmembers public class com.javafx.main.Main, com.product.main.EntryFX, net.license.LicenseEntryPoint {
public *; public static *;
}
-keep class * extends org.xml.sax.helpers.DefaultHandler
-keepclassmembers class * extends org.xml.sax.helpers.DefaultHandler {
private *;
public *;
}
</proguard>
</target>
答案 0 :(得分:4)
.fxml
个文件包含具有控制器类名称的字符串。
<Scene width="550" height="550"
fx:controller="fxmltableview.FXMLTableViewController"
xmlns:fx="http://javafx.com/fxml">
您需要将控制器排除在混淆之外,或者找出他们的新名称,并在混淆的jar中更新.fxml
个文件。