1# 2# This ProGuard configuration file illustrates how to process a program 3# library, such that it remains usable as a library. 4# Usage: 5# java -jar proguard.jar @library.pro 6# 7 8# Specify the input jars, output jars, and library jars. 9# In this case, the input jar is the program library that we want to process. 10 11-injars in.jar 12-outjars out.jar 13 14-libraryjars <java.home>/lib/rt.jar 15 16# Save the obfuscation mapping to a file, so we can de-obfuscate any stack 17# traces later on. Keep a fixed source file attribute and all line number 18# tables to get line numbers in the stack traces. 19# You can comment this out if you're not interested in stack traces. 20 21-printmapping out.map 22-keepparameternames 23-renamesourcefileattribute SourceFile 24-keepattributes Exceptions,InnerClasses,Signature,Deprecated, 25 SourceFile,LineNumberTable,EnclosingMethod 26 27# Preserve all annotations. 28 29-keepattributes *Annotation* 30 31# Preserve all public classes, and their public and protected fields and 32# methods. 33 34-keep public class * { 35 public protected *; 36} 37 38# Preserve all .class method names. 39 40-keepclassmembernames class * { 41 java.lang.Class class$(java.lang.String); 42 java.lang.Class class$(java.lang.String, boolean); 43} 44 45# Preserve all native method names and the names of their classes. 46 47-keepclasseswithmembernames,includedescriptorclasses class * { 48 native <methods>; 49} 50 51# Preserve the special static methods that are required in all enumeration 52# classes. 53 54-keepclassmembers,allowoptimization enum * { 55 public static **[] values(); 56 public static ** valueOf(java.lang.String); 57} 58 59# Explicitly preserve all serialization members. The Serializable interface 60# is only a marker interface, so it wouldn't save them. 61# You can comment this out if your library doesn't use serialization. 62# If your code contains serializable classes that have to be backward 63# compatible, please refer to the manual. 64 65-keepclassmembers class * implements java.io.Serializable { 66 static final long serialVersionUID; 67 static final java.io.ObjectStreamField[] serialPersistentFields; 68 private void writeObject(java.io.ObjectOutputStream); 69 private void readObject(java.io.ObjectInputStream); 70 java.lang.Object writeReplace(); 71 java.lang.Object readResolve(); 72} 73 74# Your library may contain more items that need to be preserved; 75# typically classes that are dynamically created using Class.forName: 76 77# -keep public class mypackage.MyClass 78# -keep public interface mypackage.MyInterface 79# -keep public class * implements mypackage.MyInterface 80