Proguard破坏了UTF-8编码

时间:2018-11-04 19:29:08

标签: java javafx proguard fxml

在我的JavaFX应用程序中,我已经用希腊语编写的.FXML文件中定义了一些Label文本。之后,.jar中包含的maven程序集文件正确并按预期运行。当我使用Proguard混淆我的代码时,.FXML文件上的编码会中断,希腊字符会显示为“?”。有提示吗?

编辑:Proguard配置是非常标准的,可以在我的其他非JavaFX项目中使用。 Proguard版本是6.0.3 `

-injars 
-outjars 
-libraryjars 'C:\Program Files\Java\jdk1.8.0_181\jre\lib\rt.jar'
-libraryjars 'C:\Users\.m2\repository\org\controlsfx\controlsfx\8.40.14\controlsfx-8.40.14.jar'
-libraryjars 'C:\Users\.m2\repository\org\mariadb\jdbc\mariadb-java-client\2.2.3\mariadb-java-client-2.2.3.jar'
-libraryjars 'C:\Users\.m2\repository\com\google\code\gson\gson\2.8.4\gson-2.8.4.jar'
-libraryjars 'C:\Program Files\Java\jdk1.8.0_181\jre\lib\javafx.properties'
-libraryjars 'C:\Program Files\Java\jdk1.8.0_181\jre\lib\javaws.jar'
-libraryjars 'C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jfxrt.jar'

-dontshrink
-dontoptimize
-flattenpackagehierarchy ''
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,LocalVariable*Table,*Annotation*,Synthetic,EnclosingMethod

-adaptresourcefilecontents **.fxml,**.properties,META-INF/MANIFEST.MF

-keepclassmembernames class * {
    @javafx.fxml.FXML *;
}

-printmapping proguard-obfuscation-mapping.out
-renamesourcefileattribute SourceFile
-adaptresourcefilenames **.properties,**.png,**.fxml
-adaptresourcefilecontents **.fxml,**.properties,META-INF/MANIFEST.MF
-flattenpackagehierarchy ''
-dontnote
-dontwarn javax.**,org.eclipse.**,com.google.**,com.sun.**,com.mysql.**
-ignorewarnings


-keep public class backend.Main {
    public static void main(java.lang.String[]);
}

# Preserve the special static methods that are required in all enumeration
# classes.
-keepclassmembers,allowoptimization enum  * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class resources.**{*;}

-keep class javax.** {
    <fields>;
    <methods>;
}

-keep class javafx.**{
    <fields>;
    <methods>;
}

-keep class org.eclipse.jface.** {
    <fields>;
    <methods>;
}

-keep class com.google.** {
    <fields>;
    <methods>;
}

-keep class java.sql.** {
    <fields>;
    <methods>;
}

-keep class org.controlsfx.** {
    <fields>;
    <methods>;
}

-keep class impl.org.controlsfx.** {
    <fields>;
    <methods>;
}

-keep class com.mysql.** {
    <fields>;
    <methods>;
}

-keep class org.mariadb.** {
    <fields>;
    <methods>;
}

-keep public class com.mysql.** {
    <fields>;
    <methods>;
}

# Keep - Applications. Keep all application classes, along with their 'main' methods.
-keepclasseswithmembers public class * {
    public static void main(java.lang.String[]);
}

# 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 - Serialization code. Keep all fields and methods that are used for
# serialization.
-keepclassmembers class * extends java.io.Serializable {
    static final long serialVersionUID;
    static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

# Also keep - Database drivers. Keep all implementations of java.sql.Driver.
-keep class * extends java.sql.Driver

# Keep - Native method names. Keep all native class/method names.
-keepclasseswithmembers,includedescriptorclasses,allowshrinking class * {
    native <methods>;
}

`

0 个答案:

没有答案