简体   繁体   中英

Obfuscation using proguard

hi i have used proguard to obfuscate my java class.After completing the obfuscation process i used java decompiler to decompile my java class at that time my class names,methods and variables did not renamed and it was opened without any change in the names what i given while i writting the code.i don't know where i did wrong the congiguration file was

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>;
}

This setting already keeps all classes with their original names (as documented):

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

Also check the ProGuard manual > Troubleshooting > Unexpected observations after processing > Variable names not being obfuscated .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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