15409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# 25409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# This ProGuard configuration file illustrates how to process Android 35409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# applications. 45409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Usage: 55409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# java -jar proguard.jar @android.pro 65409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# 75409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# If you're using the Android SDK (version 2.3 or higher), the android tool 85409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# already creates a file like this in your project, called proguard.cfg. 95409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# It should contain the settings of this file, minus the input and output paths 105409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# (-injars, -outjars, -libraryjars, -printmapping, and -printseeds). 115409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# The generated Ant build file automatically sets these paths. 125409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 135409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Specify the input jars, output jars, and library jars. 145409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Note that ProGuard works with Java bytecode (.class), 155409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# before the dex compiler converts it into Dalvik code (.dex). 165409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 175409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-injars bin/classes 185409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-injars libs 195409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-outjars bin/classes-processed.jar 205409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 215409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-libraryjars /usr/local/android-sdk/platforms/android-9/android.jar 225409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye#-libraryjars /usr/local/android-sdk/add-ons/google_apis-7_r01/libs/maps.jar 235409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# ... 245409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 255409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Save the obfuscation mapping to a file, so you can de-obfuscate any stack 265409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# traces later on. 275409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 285409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-printmapping bin/classes-processed.map 295409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 305409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# You can print out the seeds that are matching the keep options below. 315409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 325409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye#-printseeds bin/classes-processed.seeds 335409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 345409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Preverification is irrelevant for the dex compiler and the Dalvik VM. 355409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 365409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-dontpreverify 375409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 385409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Reduce the size of the output some more. 395409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 405409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-repackageclasses '' 415409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-allowaccessmodification 425409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 435409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Switch off some optimizations that trip older versions of the Dalvik VM. 445409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 455409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-optimizations !code/simplification/arithmetic 465409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 475409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Keep a fixed source file attribute and all line number tables to get line 485409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# numbers in the stack traces. 495409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# You can comment this out if you're not interested in stack traces. 505409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 515409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-renamesourcefileattribute SourceFile 525409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keepattributes SourceFile,LineNumberTable 535409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 545409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# RemoteViews might need annotations. 555409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 565409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keepattributes *Annotation* 575409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 585409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Preserve all fundamental application classes. 595409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 605409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keep public class * extends android.app.Activity 615409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keep public class * extends android.app.Application 625409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keep public class * extends android.app.Service 635409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keep public class * extends android.content.BroadcastReceiver 645409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keep public class * extends android.content.ContentProvider 655409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 665409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Preserve all View implementations, their special context constructors, and 675409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# their setters. 685409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 695409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keep public class * extends android.view.View { 705409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye public <init>(android.content.Context); 715409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye public <init>(android.content.Context, android.util.AttributeSet); 725409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye public <init>(android.content.Context, android.util.AttributeSet, int); 735409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye public void set*(...); 745409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye} 755409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 765409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Preserve all classes that have special context constructors, and the 775409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# constructors themselves. 785409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 795409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keepclasseswithmembers class * { 805409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye public <init>(android.content.Context, android.util.AttributeSet); 815409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye} 825409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 835409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Preserve all classes that have special context constructors, and the 845409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# constructors themselves. 855409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 865409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keepclasseswithmembers class * { 875409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye public <init>(android.content.Context, android.util.AttributeSet, int); 885409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye} 895409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 905409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Preserve the special fields of all Parcelable implementations. 915409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 925409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keepclassmembers class * implements android.os.Parcelable { 935409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye static android.os.Parcelable$Creator CREATOR; 945409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye} 955409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 965409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Preserve static fields of inner classes of R classes that might be accessed 975409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# through introspection. 985409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 995409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keepclassmembers class **.R$* { 1005409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye public static <fields>; 1015409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye} 1025409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 1035409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Preserve the required interface from the License Verification Library 1045409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# (but don't nag the developer if the library is not used at all). 1055409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 1065409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keep public interface com.android.vending.licensing.ILicensingService 1075409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 1085409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-dontnote com.android.vending.licensing.ILicensingService 1095409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 1105409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# The Android Compatibility library references some classes that may not be 1115409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# present in all versions of the API, but we know that's ok. 1125409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 1135409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-dontwarn android.support.** 1145409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 1155409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Preserve all native method names and the names of their classes. 1165409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 1175409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keepclasseswithmembernames class * { 1185409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye native <methods>; 1195409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye} 1205409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 1215409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Preserve the special static methods that are required in all enumeration 1225409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# classes. 1235409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 1245409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keepclassmembers class * extends java.lang.Enum { 1255409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye public static **[] values(); 1265409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye public static ** valueOf(java.lang.String); 1275409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye} 1285409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 1295409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Explicitly preserve all serialization members. The Serializable interface 1305409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# is only a marker interface, so it wouldn't save them. 1315409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# You can comment this out if your application doesn't use serialization. 1325409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# If your code contains serializable classes that have to be backward 1335409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# compatible, please refer to the manual. 1345409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 1355409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye-keepclassmembers class * implements java.io.Serializable { 1365409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye static final long serialVersionUID; 1375409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye static final java.io.ObjectStreamField[] serialPersistentFields; 1385409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye private void writeObject(java.io.ObjectOutputStream); 1395409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye private void readObject(java.io.ObjectInputStream); 1405409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye java.lang.Object writeReplace(); 1415409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye java.lang.Object readResolve(); 1425409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye} 1435409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 1445409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# Your application may contain more items that need to be preserved; 1455409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# typically classes that are dynamically created using Class.forName: 1465409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye 1475409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# -keep public class mypackage.MyClass 1485409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# -keep public interface mypackage.MyInterface 1495409c1bdc2a4ef9fe1379af5821c403c193cc2a7Tor Norbye# -keep public class * implements mypackage.MyInterface 150