繁体   English   中英

使用proguard进行混淆

[英]Obfuscation using proguard

嗨,我使用过proguard对我的java类进行模糊处理。完成模糊化处理后,我当时使用java decompiler对我的java类进行反编译,而我的类名,方法和变量没有重命名,并且打开时没有更改名称,我在写代码时给出了。我不知道我在哪里弄错了配置文件

injars 'E:\vsd_02\workplace\pro\dist\pro.jar'
-outjars 'E:\vsd_02\workplace\pro\dist\pro_out.jar'

-libraryjars 'C:\Program Files\Java\jre7\lib\rt.jar'

-forceprocessing
-printmapping 'E:\vsd_02\workplace\pro\dist\pro.map'
-repackageclasses ''
-renamesourcefileattribute SourceFile
-verbose
-dontwarn


# 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 - Bean classes. Keep all specified classes, along with their getters
# and setters.
-keep class * {
    void set*(***);
    void set*(int,***);
    boolean is*();
    boolean is*(int);
    *** get*();
    *** get*(int);
}

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

# Also keep - Swing UI L&F. Keep all extensions of javax.swing.plaf.ComponentUI,
# along with the special 'createUI' method.
-keep class * extends javax.swing.plaf.ComponentUI {
    public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent);
}

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

此设置已使所有类保留其原始名称(如所记录):

# Also keep - Bean classes. Keep all specified classes, along with their getters
# and setters.
-keep class * {
    .....
}

还要检查ProGuard手册>故障排除>处理后出现异常现象> 变量名不会被混淆

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM