From 7df8b045219858929322204406e7054e3a6d5169 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 27 Mar 2021 13:41:28 +0530 Subject: [PATCH] Re-enable minification and add a custom proguard-android-optimize ruleset Signed-off-by: Harsh Shandilya --- build.gradle | 2 ++ proguard-android-optimize.txt | 36 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 proguard-android-optimize.txt diff --git a/build.gradle b/build.gradle index b35c0b783f..8d5e8bdabb 100644 --- a/build.gradle +++ b/build.gradle @@ -96,8 +96,10 @@ android { } release { + minifyEnabled true shrinkResources true versionNameSuffix ".release" + proguardFiles "proguard-android-optimize.txt", "proguard.flags" } } diff --git a/proguard-android-optimize.txt b/proguard-android-optimize.txt new file mode 100644 index 0000000000..e2095ad66f --- /dev/null +++ b/proguard-android-optimize.txt @@ -0,0 +1,36 @@ +-allowaccessmodification +-dontpreverify +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-verbose + +-keepattributes *Annotation* + +-keepclasseswithmembernames class * { + native ; +} + +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keepclassmembers class * implements android.os.Parcelable { + public static final ** CREATOR; +} + +-keep class androidx.annotation.Keep + +-keep @androidx.annotation.Keep class * {*;} + +-keepclasseswithmembers class * { + @androidx.annotation.Keep ; +} + +-keepclasseswithmembers class * { + @androidx.annotation.Keep ; +} + +-keepclasseswithmembers class * { + @androidx.annotation.Keep (...); +}