build: Improve R8 rules and enable aggressive optimization modes
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
456a74db05
commit
b3bb7c694b
@ -17,3 +17,17 @@ org.gradle.jvmargs=-Xmx1536m
|
|||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
|
|
||||||
|
# R8 Full mode
|
||||||
|
android.enableR8.fullMode=true
|
||||||
|
|
||||||
|
# https://jakewharton.com/increased-accuracy-of-aapt2-keep-rules/
|
||||||
|
android.useMinimalKeepRules=true
|
||||||
|
|
||||||
|
# Enable rudimentary R class namespacing where each library only contains
|
||||||
|
# references to the resources it declares instead of declarations plus all
|
||||||
|
# transitive dependency references.
|
||||||
|
android.namespacedRClass=true
|
||||||
|
|
||||||
|
# Suppress warnings for some features that aren't yet stabilized
|
||||||
|
android.suppressUnsupportedOptionWarnings=android.enableR8.fullMode,android.useMinimalKeepRules,android.namespacedRClass,android.suppressUnsupportedOptionWarnings
|
||||||
|
@ -57,7 +57,7 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
|
proguardFiles "proguard-android-optimize.txt", "proguard-rules.pro"
|
||||||
}
|
}
|
||||||
debug {
|
debug {
|
||||||
applicationIdSuffix ".debug"
|
applicationIdSuffix ".debug"
|
||||||
|
36
ui/proguard-android-optimize.txt
Normal file
36
ui/proguard-android-optimize.txt
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
-allowaccessmodification
|
||||||
|
-dontpreverify
|
||||||
|
-dontusemixedcaseclassnames
|
||||||
|
-dontskipnonpubliclibraryclasses
|
||||||
|
-verbose
|
||||||
|
|
||||||
|
-keepattributes *Annotation*
|
||||||
|
|
||||||
|
-keepclasseswithmembernames class * {
|
||||||
|
native <methods>;
|
||||||
|
}
|
||||||
|
|
||||||
|
-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 <methods>;
|
||||||
|
}
|
||||||
|
|
||||||
|
-keepclasseswithmembers class * {
|
||||||
|
@androidx.annotation.Keep <fields>;
|
||||||
|
}
|
||||||
|
|
||||||
|
-keepclasseswithmembers class * {
|
||||||
|
@androidx.annotation.Keep <init>(...);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user