Android常用三方库混淆规则整理(小结)

  -keep public class * extends android.support.v7.app.AppCompatActivity

  -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 * extends android.view.View

  -keep public class com.android.vending.licensing.ILicensingService

  -keep class android.support.** {*;}

  -keepclasseswithmembernames class * {

  native ;

  }

  -keepclassmembers class * extends android.support.v7.app.AppCompatActivity{

  public void *(android.view.View);

  }

  -keepclassmembers enum * { *; }

  -keep public class * extends android.view.View{

  *** get*();

  void set*(***);

  public (android.content.Context);

  public (android.content.Context, android.util.AttributeSet);

  public (android.content.Context, android.util.AttributeSet, int);

  }

  -keepclasseswithmembers class * {

  public (android.content.Context, android.util.AttributeSet);

  public (android.content.Context, android.util.AttributeSet, int);

  }

  -keep class * implements android.os.Parcelable {

  public static final android.os.Parcelable$Creator *;

  }

  -keepclassmembers class * implements java.io.Serializable {

  static final long serialVersionUID;

  private static final java.io.ObjectStreamField[] serialPersistentFields;

  private void writeObject(java.io.ObjectOutputStream);

  private void readObject(java.io.ObjectInputStream);

  java.lang.Object writeReplace();

  java.lang.Object readResolve();

  }

  -keep class **.R$* {

  *;

  }

  -keepclassmembers class * {

  void *(**On*Event);

  }