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