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 # Save the obfuscation mapping to a file, so you can de-obfuscate any stack
     19 # traces later on. Keep a fixed source file attribute and all line number
     20 # tables to get line numbers in the stack traces.
     21 # You can comment this out if you're not interested in stack traces.
     22 
     23 -printmapping out.map
     24 -renamesourcefileattribute SourceFile
     25 -keepattributes SourceFile,LineNumberTable
     26 
     27 # Preserve all annotations.
     28 
     29 -keepattributes *Annotation*
     30 
     31 # You can print out the seeds that are matching the keep options below.
     32 
     33 #-printseeds out.seeds
     34 
     35 # Preserve all public applications.
     36 
     37 -keepclasseswithmembers public class * {
     38     public static void main(java.lang.String[]);
     39 }
     40 
     41 # Preserve all native method names and the names of their classes.
     42 
     43 -keepclasseswithmembernames class * {
     44     native <methods>;
     45 }
     46 
     47 # Preserve the special static methods that are required in all enumeration
     48 # classes.
     49 
     50 -keepclassmembers class * extends java.lang.Enum {
     51     public static **[] values();
     52     public static ** valueOf(java.lang.String);
     53 }
     54 
     55 # Explicitly preserve all serialization members. The Serializable interface
     56 # is only a marker interface, so it wouldn't save them.
     57 # You can comment this out if your application doesn't use serialization.
     58 # If your code contains serializable classes that have to be backward 
     59 # compatible, please refer to the manual.
     60 
     61 -keepclassmembers class * implements java.io.Serializable {
     62     static final long serialVersionUID;
     63     static final java.io.ObjectStreamField[] serialPersistentFields;
     64     private void writeObject(java.io.ObjectOutputStream);
     65     private void readObject(java.io.ObjectInputStream);
     66     java.lang.Object writeReplace();
     67     java.lang.Object readResolve();
     68 }
     69 
     70 # Your application may contain more items that need to be preserved; 
     71 # typically classes that are dynamically created using Class.forName:
     72 
     73 # -keep public class mypackage.MyClass
     74 # -keep public interface mypackage.MyInterface
     75 # -keep public class * implements mypackage.MyInterface
     76