2012-01-04 247 views
0

嗨我已经使用proguard来模糊我的java类。完成混淆处理后,我使用java反编译器来反编译我的java类当时我的类名称,方法和变量没有重命名,并且它没有任何打开在我,而我的书面方式给予code.i名称变更不知道我做错了congiguration文件是使用proguard混淆

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

回答

0

这个设置已经保存了所有的类与原来的名称(如记录):

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

另请检查ProGuard ma nual>故障排除>处理后意外的意见>Variable names not being obfuscated