add more aggressive proguard config (#741)

* add more aggressive proguard config

* even more optimizations
This commit is contained in:
Konrad Pozniak 2018-08-15 20:46:37 +02:00 committed by GitHub
parent b9e433c77f
commit 418c76d677
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 17 deletions

View file

@ -28,7 +28,7 @@ android {
release { release {
minifyEnabled true minifyEnabled true
shrinkResources true shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles 'proguard-rules.pro'
} }
debug { } debug { }
} }

View file

@ -1,20 +1,47 @@
# Add project specific ProGuard rules here. # GENERAL OPTIONS
# 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
# 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 -dontusemixedcaseclassnames
# and specify the fully qualified class name to the JavaScript interface -dontskipnonpubliclibraryclasses
# class: -keepattributes *Annotation*
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *; # For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
#} -keepclasseswithmembernames class * {
native <methods>;
}
# 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 <fields>;
}
# 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 ## for okhttp
-dontwarn okio.** -dontwarn okio.**
@ -50,6 +77,7 @@
# preserve line numbers for crash reporting # preserve line numbers for crash reporting
-keepattributes SourceFile,LineNumberTable -keepattributes SourceFile,LineNumberTable
-renamesourcefileattribute SourceFile
# remove all logging from production apk # remove all logging from production apk
-assumenosideeffects class android.util.Log { -assumenosideeffects class android.util.Log {