2012-01-04 261 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