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