1# 2# This ProGuard configuration file illustrates how to process Android 3# applications. 4# Usage: 5# java -jar proguard.jar @android.pro 6# 7# If you're using the Android SDK (version 2.3 or higher), the android tool 8# already creates a file like this in your project, called proguard.cfg. 9# It should contain the settings of this file, minus the input and output paths 10# (-injars, -outjars, -libraryjars, -printmapping, and -printseeds). 11# The generated Ant build file automatically sets these paths. 12 13# Specify the input jars, output jars, and library jars. 14# Note that ProGuard works with Java bytecode (.class), 15# before the dex compiler converts it into Dalvik code (.dex). 16 17-injars bin/classes 18-injars libs 19-outjars bin/classes-processed.jar 20 21-libraryjars /usr/local/android-sdk/platforms/android-9/android.jar 22#-libraryjars /usr/local/android-sdk/add-ons/google_apis-7_r01/libs/maps.jar 23# ... 24 25# Save the obfuscation mapping to a file, so you can de-obfuscate any stack 26# traces later on. 27 28-printmapping bin/classes-processed.map 29 30# You can print out the seeds that are matching the keep options below. 31 32#-printseeds bin/classes-processed.seeds 33 34# Preverification is irrelevant for the dex compiler and the Dalvik VM. 35 36-dontpreverify 37 38# Reduce the size of the output some more. 39 40-repackageclasses '' 41-allowaccessmodification 42 43# Switch off some optimizations that trip older versions of the Dalvik VM. 44 45-optimizations !code/simplification/arithmetic 46 47# Keep a fixed source file attribute and all line number tables to get line 48# numbers in the stack traces. 49# You can comment this out if you're not interested in stack traces. 50 51-renamesourcefileattribute SourceFile 52-keepattributes SourceFile,LineNumberTable 53 54# RemoteViews might need annotations. 55 56-keepattributes *Annotation* 57 58# Preserve all fundamental application classes. 59 60-keep public class * extends android.app.Activity 61-keep public class * extends android.app.Application 62-keep public class * extends android.app.Service 63-keep public class * extends android.content.BroadcastReceiver 64-keep public class * extends android.content.ContentProvider 65 66# Preserve all View implementations, their special context constructors, and 67# their setters. 68 69-keep public class * extends android.view.View { 70 public <init>(android.content.Context); 71 public <init>(android.content.Context, android.util.AttributeSet); 72 public <init>(android.content.Context, android.util.AttributeSet, int); 73 public void set*(...); 74} 75 76# Preserve all classes that have special context constructors, and the 77# constructors themselves. 78 79-keepclasseswithmembers class * { 80 public <init>(android.content.Context, android.util.AttributeSet); 81} 82 83# Preserve all classes that have special context constructors, and the 84# constructors themselves. 85 86-keepclasseswithmembers class * { 87 public <init>(android.content.Context, android.util.AttributeSet, int); 88} 89 90# Preserve the special fields of all Parcelable implementations. 91 92-keepclassmembers class * implements android.os.Parcelable { 93 static android.os.Parcelable$Creator CREATOR; 94} 95 96# Preserve static fields of inner classes of R classes that might be accessed 97# through introspection. 98 99-keepclassmembers class **.R$* { 100 public static <fields>; 101} 102 103# Preserve the required interface from the License Verification Library 104# (but don't nag the developer if the library is not used at all). 105 106-keep public interface com.android.vending.licensing.ILicensingService 107 108-dontnote com.android.vending.licensing.ILicensingService 109 110# The Android Compatibility library references some classes that may not be 111# present in all versions of the API, but we know that's ok. 112 113-dontwarn android.support.** 114 115# Preserve all native method names and the names of their classes. 116 117-keepclasseswithmembernames class * { 118 native <methods>; 119} 120 121# Preserve the special static methods that are required in all enumeration 122# classes. 123 124-keepclassmembers class * extends java.lang.Enum { 125 public static **[] values(); 126 public static ** valueOf(java.lang.String); 127} 128 129# Explicitly preserve all serialization members. The Serializable interface 130# is only a marker interface, so it wouldn't save them. 131# You can comment this out if your application doesn't use serialization. 132# If your code contains serializable classes that have to be backward 133# compatible, please refer to the manual. 134 135-keepclassmembers class * implements java.io.Serializable { 136 static final long serialVersionUID; 137 static final java.io.ObjectStreamField[] serialPersistentFields; 138 private void writeObject(java.io.ObjectOutputStream); 139 private void readObject(java.io.ObjectInputStream); 140 java.lang.Object writeReplace(); 141 java.lang.Object readResolve(); 142} 143 144# Your application may contain more items that need to be preserved; 145# typically classes that are dynamically created using Class.forName: 146 147# -keep public class mypackage.MyClass 148# -keep public interface mypackage.MyInterface 149# -keep public class * implements mypackage.MyInterface 150