Reprinted from: http://my.oschina.net/zhangzhihao/blog/72393
#-------------------------------------# android original obfuscation template #-------------------------------------#------------------- ---------------#-optimizationpasses n#-----------------------------------optimizationpasses 5 #-----By specifying a number of optimizations to perform # -----------------------------# Confusion does not produce a variety of class names #-dontusemixedcaseclassnames#----------------------------------#- dontusemixedcaseclassnames#----------------------------------# Specifies not to ignore non-public Library classes #-dontskipnonpubliclibraryclasses#-- --------------------------------#-dontskipnonpubliclibraryclasses #----------------------------------# no pre-check #-do ntpreverify#----------------------------------#-dontpreverify #----------------------------------# output Generate information #- verbose#-----------------------------------verbose #----------------------------------# optimization Option # optimizations {o Ptimization_filter} #-----------------------------------Optimizations!code/simplification/arithmetic,!field/*,! class/merging/*-keep public class * extends AndroidOid.app.activity-keep public class * extends Android.app.application-keep public class * extends Android.app.service-keep public class * extends Android.content.broadcastreceiver-keep public class * extends Android.content.contentprovider-keep public class * extends Android.app.backup.backupagenthelper-keep public class * Extends Android.preference.preference-keep public class Com.android.vending.licensing.ILicensingService- Keepclasseswithmembernames class * {native<Methods>;} #-----------------# Modify Modify Merge #------------------Keep public class * extends Android.view.View { public<Init>(Android.content.Context); Public<Init>(Android.content.Context, Android.util.AttributeSet); Public<Init>(Android.content.Context, android.util.AttributeSet, int); public void set* (...);} -keepclassmembers enum * {public static **[] values (); public static * * VALUEOF (java.lang.String);} -keep class * Implements android.os.Parcelable {public static final Android.os.parcelable$creator *;} #----------------- ---------# Protection Type-keepattributes Description # Exceptions, Signature, Deprecated, SourceFile, SourceDir, linenumbertable, Localvari Abletable, # localvariabletypetable, synthetic, Enclosingmethod, Runtimevisibleannotations, Runtimeinvisibleannotations, # runtimevisibleparameterannotations, Runtimeinvisibleparameterannotations, and annotationdefault#---------------------keepattributes **-libraryjars<Java.home>/lib/rt.jar #----------------------# does not compress the specified file #-dontshrink#-----------------------Dontshrink #---------------- ------# does not optimize the specified file #-dontoptimize#------------------------dontoptimize #-----------------------# does not confuse the specified file #-dontobfus cate#-----------------------#-----Obfuscation package path--------repackageclasses "-flattenpackagehierarchy"-target 1.6 #-------- The following are the fields and class-related---------that are required to be protected using the Roboguice-1.1.2.jar and Guice-2.0-no_app.jar functions keep class Com.google.inject.binder-keepclassmembers class * {@com. Google.inject.Inject<Init>(...);} -keepclassmembers class * {void * (**on*event);} -keepclassmembers class * *. r$* {public static< Fields>;} #------The jar package needed to compile the-libraryjars d:/dev_rc/android-sdk-windows/add-ons/addon_google_apis_google_inc_11/libs/ Maps.jar #------Protect Google Third party jar package, interface effects-----------Keep class Android.support.v4.**-dontwarn android.support.v4.** #------ Protect Baidu Address jar Package---------Keep class com.baidu.mapapi.** {*;} -dontwarn com.baidu.mapapi.** #---When packaging ignores warnings for the following classes---dontwarn Com.classpackage.AA #-keepnames class * Implements Java.io.Se rializable#---------Protect field names in all entities-----------Keepclassmembers class * Implements Java.io.Serializable {< Fields>;} #---------All method names in the protection class-------------Keepclassmembers class * { public<Methods>;}
[Android Pro] proguard.cfg configuration file