1 # 2 # This ProGuard configuration file illustrates how to use annotations for 3 # specifying which classes and class members should be kept. 4 # Usage: 5 # java -jar proguard.jar @examples.pro 6 # 7 8 # Specify the input, output, and library jars. 9 # This is assuming the code has been compiled in the examples directory. 10 11 -injars examples(*.class) 12 -outjars out 13 14 -libraryjars <java.home>/lib/rt.jar 15 16 # Some important configuration is based on the annotations in the code. 17 # We have to specify what the annotations mean to ProGuard. 18 19 -include lib/annotations.pro 20 21 # 22 # We can then still add any other options that might be useful. 23 # 24 25 # Print out a list of what we're preserving. 26 27 -printseeds 28 29 # Preserve all annotations themselves. 30 31 -keepattributes *Annotation* 32 33 # Preserve all native method names and the names of their classes. 34 35 -keepclasseswithmembernames,includedescriptorclasses class * { 36 native <methods>; 37 } 38 39 # Preserve the special static methods that are required in all enumeration 40 # classes. 41 42 -keepclassmembers,allowoptimization enum * { 43 public static **[] values(); 44 public static ** valueOf(java.lang.String); 45 } 46 47 # Explicitly preserve all serialization members. The Serializable interface 48 # is only a marker interface, so it wouldn't save them. 49 # You can comment this out if your application doesn't use serialization. 50 # If your code contains serializable classes that have to be backward 51 # compatible, please refer to the manual. 52 53 -keepclassmembers class * implements java.io.Serializable { 54 static final long serialVersionUID; 55 static final java.io.ObjectStreamField[] serialPersistentFields; 56 private void writeObject(java.io.ObjectOutputStream); 57 private void readObject(java.io.ObjectInputStream); 58 java.lang.Object writeReplace(); 59 java.lang.Object readResolve(); 60 } 61