4

我正在使用混淆我的 javafx 应用程序 jar,Proguard 4.8并且混淆的 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>
4

1 回答 1

4

.fxml文件具有控制器类的确切名称的字符串。

<Scene width="550" height="550"
    fx:controller="fxmltableview.FXMLTableViewController" 
    xmlns:fx="http://javafx.com/fxml">

您需要从混淆中排除控制器,或者找出它们的新名称并更新.fxml混淆 jar 中的文件。

于 2012-12-28T20:26:49.563 回答