Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# This is a configuration file for ProGuard.
# Starting with version 2.2 of the Android plugin for Gradle, this file is distributed together with
# the plugin and unpacked at build-time. The files in $ANDROID_HOME are no longer maintained and
# will be ignored by new version of the Android plugin for Gradle.
# Optimization is turned off by default. Dex does not like code run
# through the ProGuard optimize and preverify steps (and performs some
# of these optimizations on its own).
# -dontoptimize
-optimizationpasses 5
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable,!class/unboxing/enum
# Preserve some attributes that may be required for reflection.
-keepattributes *Annotation*,Signature,InnerClasses,EnclosingMethod
-keep public class
-keep public class
-keep public class
# For native methods, see
-keepclasseswithmembernames class * {
native <methods>;
# !!!以下两段内容请自行考虑是否启用!!!
# Keep setters in Views so that animations can still work.
# -keepclassmembers public class * extends android.view.View {
# void set*(***);
# *** get*();
# }
# We want to keep methods in Activity that could be used in the XML attribute onClick.
# -keepclassmembers class * extends {
# public void *(android.view.View);
# }
# For enumeration classes, see
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
-keepclassmembers class * implements android.os.Parcelable {
public static final ** CREATOR;
-keepclassmembers class **.R$* {
public static <fields>;
# Preserve annotated Javascript interface methods.
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
# The support libraries contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version. We know about them, and they are safe.
-dontwarn javax.annotation.**
# Understand the @Keep support annotation.
-keep class
-keep class androidx.annotation.Keep
-keep class * {*;}
-keep @androidx.annotation.Keep class * {*;}
-keepclasseswithmembers class * { <methods>;
-keepclasseswithmembers class * { <fields>;
-keepclasseswithmembers class * { <init>(...);
-keepclasseswithmembers class * {
@androidx.annotation.Keep <methods>;
-keepclasseswithmembers class * {
@androidx.annotation.Keep <fields>;
-keepclasseswithmembers class * {
@androidx.annotation.Keep <init>(...);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.