From 418c76d677ab90a20704b709744cf33e29f69c94 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Wed, 15 Aug 2018 20:46:37 +0200 Subject: [PATCH] add more aggressive proguard config (#741) * add more aggressive proguard config * even more optimizations --- app/build.gradle | 2 +- app/proguard-rules.pro | 60 +++++++++++++++++++++++++++++++----------- 2 files changed, 45 insertions(+), 17 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 687359ee2..b3ba85e62 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -28,7 +28,7 @@ android { release { minifyEnabled true shrinkResources true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + proguardFiles 'proguard-rules.pro' } debug { } } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 4f6c3dfd1..cfec88cf5 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,20 +1,47 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /home/andrew/Android/Sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html +# GENERAL OPTIONS -# Add any project specific keep options here: +# turn on all optimizations except those that are known to cause problems on Android +-optimizations !code/simplification/cast,!field/*,!class/merging/* +-optimizationpasses 6 +-allowaccessmodification +-dontpreverify -# 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 *; -#} +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-keepattributes *Annotation* + +# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native +-keepclasseswithmembernames class * { + native ; +} +# keep setters in Views so that animations can still work. +# see http://proguard.sourceforge.net/manual/examples.html#beans +-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 android.app.Activity { + public void *(android.view.View); +} +# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} +-keepclassmembers class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator CREATOR; +} +-keepclassmembers class **.R$* { + public static ; +} +# The support library 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 android.support.** + + +# TUSKY SPECIFIC OPTIONS ## for okhttp -dontwarn okio.** @@ -50,6 +77,7 @@ # preserve line numbers for crash reporting -keepattributes SourceFile,LineNumberTable +-renamesourcefileattribute SourceFile # remove all logging from production apk -assumenosideeffects class android.util.Log { @@ -65,4 +93,4 @@ static void checkParameterIsNotNull(java.lang.Object, java.lang.String); } --dontwarn com.google.errorprone.annotations.* \ No newline at end of file +-dontwarn com.google.errorprone.annotations.*