Home | History | Annotate | Download | only in examples
      1 #
      2 # This ProGuard configuration file illustrates how to process applications.
      3 # Usage:
      4 #     java -jar proguard.jar @applications.pro
      5 #
      6 
      7 # Specify the input jars, output jars, and library jars.
      8 
      9 -injars  in.jar
     10 -outjars out.jar
     11 
     12 -libraryjars <java.home>/lib/rt.jar
     13 #-libraryjars junit.jar
     14 #-libraryjars servlet.jar
     15 #-libraryjars jai_core.jar
     16 #...
     17 
     18 # Preserve all public applications.
     19 
     20 -keepclasseswithmembers public class * {
     21     public static void main(java.lang.String[]);
     22 }
     23 
     24 # Print out a list of what we're preserving.
     25 
     26 -printseeds
     27 
     28 # Preserve all annotations.
     29 
     30 -keepattributes *Annotation*
     31 
     32 # Preserve all native method names and the names of their classes.
     33 
     34 -keepclasseswithmembernames class * {
     35     native <methods>;
     36 }
     37 
     38 # Preserve the special static methods that are required in all enumeration
     39 # classes.
     40 
     41 -keepclassmembers class * extends java.lang.Enum {
     42     public static **[] values();
     43     public static ** valueOf(java.lang.String);
     44 }
     45 
     46 # Explicitly preserve all serialization members. The Serializable interface
     47 # is only a marker interface, so it wouldn't save them.
     48 # You can comment this out if your application doesn't use serialization.
     49 # If your code contains serializable classes that have to be backward 
     50 # compatible, please refer to the manual.
     51 
     52 -keepclassmembers class * implements java.io.Serializable {
     53     static final long serialVersionUID;
     54     static final java.io.ObjectStreamField[] serialPersistentFields;
     55     private void writeObject(java.io.ObjectOutputStream);
     56     private void readObject(java.io.ObjectInputStream);
     57     java.lang.Object writeReplace();
     58     java.lang.Object readResolve();
     59 }
     60 
     61 # Your application may contain more items that need to be preserved; 
     62 # typically classes that are dynamically created using Class.forName:
     63 
     64 # -keep public class mypackage.MyClass
     65 # -keep public interface mypackage.MyInterface
     66 # -keep public class * implements mypackage.MyInterface
     67