From fa9112e117795565194da4d1c409fd00d5681451 Mon Sep 17 00:00:00 2001 From: Grishka Date: Tue, 29 Mar 2022 10:38:38 +0300 Subject: [PATCH] Enable minification for release builds --- mastodon/build.gradle | 8 ++++--- mastodon/proguard-rules.pro | 22 ++++++++++++++++++- .../src/main/res/layout/fragment_profile.xml | 2 ++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/mastodon/build.gradle b/mastodon/build.gradle index 32866fc5..8c798723 100644 --- a/mastodon/build.gradle +++ b/mastodon/build.gradle @@ -10,14 +10,15 @@ android { applicationId "org.joinmastodon.android" minSdk 23 targetSdk 31 - versionCode 16 + versionCode 17 versionName "0.1" } buildTypes { release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + minifyEnabled true + shrinkResources true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug{ debuggable true @@ -25,6 +26,7 @@ android { appcenterPrivateBeta{ initWith release minifyEnabled false + shrinkResources false versionNameSuffix "-priv-beta" } appcenterPublicBeta{ diff --git a/mastodon/proguard-rules.pro b/mastodon/proguard-rules.pro index 481bb434..d2e08eb2 100644 --- a/mastodon/proguard-rules.pro +++ b/mastodon/proguard-rules.pro @@ -18,4 +18,24 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile + +# Keep all model classes as they're used with gson and their names are shown in errors +-keep public class org.joinmastodon.android.model.**{ + ; +} + +# Inner classes in api requests are used with gson +-keepclassmembers class org.joinmastodon.android.api.**$*{ + *; +} + +# Keep all enums for debugging purposes +-keepnames public enum * { + *; +} + +-keepclassmembers,allowobfuscation class * { + @com.google.gson.annotations.SerializedName ; + @com.squareup.otto.Subscribe ; +} \ No newline at end of file diff --git a/mastodon/src/main/res/layout/fragment_profile.xml b/mastodon/src/main/res/layout/fragment_profile.xml index b64b7a98..4f86d3d6 100644 --- a/mastodon/src/main/res/layout/fragment_profile.xml +++ b/mastodon/src/main/res/layout/fragment_profile.xml @@ -204,6 +204,7 @@ android:background="@drawable/edit_text_border" android:inputType="textPersonName|textCapWords" android:visibility="gone" + android:elevation="0dp" tools:text="Eugen" />