From c903c7357ad64d5256e885ba264d0c1450931fa8 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 25 Oct 2020 00:38:41 +0530 Subject: [PATCH 1/2] build: turn on minification Signed-off-by: Harsh Shandilya --- app/build.gradle | 4 ++-- app/proguard-android-optimize.txt | 36 +++++++++++++++++++++++++++++++ app/proguard-rules.pro | 21 ------------------ 3 files changed, 38 insertions(+), 23 deletions(-) create mode 100644 app/proguard-android-optimize.txt diff --git a/app/build.gradle b/app/build.gradle index 0c6a3524..712603b4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,8 +15,8 @@ android { buildTypes { release { - minifyEnabled false - proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" + minifyEnabled true + proguardFiles "proguard-android-optimize.txt", "proguard-rules.pro" } } diff --git a/app/proguard-android-optimize.txt b/app/proguard-android-optimize.txt new file mode 100644 index 00000000..e2095ad6 --- /dev/null +++ b/app/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 (...); +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb434..e69de29b 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file From 405a60b09b15e191b8b549461edb491c525bdd72 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 25 Oct 2020 00:38:53 +0530 Subject: [PATCH 2/2] gradle: disable R8 full mode Signed-off-by: Harsh Shandilya --- gradle.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index bc6a197f..3b2000c1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,7 +21,8 @@ kapt.incremental.apt=true kapt.include.compile.classpath=false # Use R8 instead of ProGuard for code shrinking. -android.enableR8.fullMode=true +# R8 Full Mode be nasty +# android.enableR8.fullMode=true # Enable AndroidX android.useAndroidX=true