From bfb49b80be70c8f35e0933be8b2de738a4efeaff Mon Sep 17 00:00:00 2001 From: Damontecres Date: Sat, 23 May 2026 14:08:38 -0400 Subject: [PATCH] Enable minify optimizations for release builds (#1437) ## Description Enables minify & resource shrinking for release builds. This should improve overall performance a bit. It also decreases the apk size by ~15%. Also updates AGP ### Related issues N/A ### Testing Emulator, but needs more testing before a final release ## Screenshots N/A ## AI or LLM usage None --- .github/workflows/main.yml | 7 +++++++ .github/workflows/release.yml | 7 +++++++ app/build.gradle.kts | 4 +++- app/proguard-rules.pro | 27 ++++++++------------------- gradle.properties | 1 + gradle/libs.versions.toml | 2 +- 6 files changed, 27 insertions(+), 21 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 348b6bf1..6cb20eeb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -75,6 +75,13 @@ jobs: run: | echo "SHA256 checksums:" find app/build/outputs/apk -name '*.apk' -print0 | xargs -0 sha256sum + - name: Upload mapping files + uses: actions/upload-artifact@v7 + with: + name: mapping + path: | + app/build/outputs/**/mapping.txt + compression-level: 6 - name: Delete ${{ env.TAG_NAME }} tag and release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4f4fc429..54b4418e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,6 +64,13 @@ jobs: path: | app/build/outputs/bundle/**/*.aab compression-level: 0 + - name: Upload mapping files + uses: actions/upload-artifact@v7 + with: + name: mapping + path: | + app/build/outputs/**/mapping.txt + compression-level: 6 - name: Create GitHub release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7f5bbcec..f7df2fb5 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -82,7 +82,8 @@ configure { buildTypes { release { - isMinifyEnabled = false + isMinifyEnabled = true + isShrinkResources = true proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro", @@ -105,6 +106,7 @@ configure { debug { isMinifyEnabled = false + isShrinkResources = false isDebuggable = true applicationIdSuffix = ".debug" } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 462dd204..ec0ffe67 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,21 +1,10 @@ -# 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 +-keep class com.github.damontecres.wholphin.util.mpv.* { *; } + +-keep class * extends com.google.protobuf.GeneratedMessageLite { *; } +-keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite { + ; + ; +} +-dontwarn com.google.protobuf.** diff --git a/gradle.properties b/gradle.properties index 26e5ff1a..6c29e7b3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -27,6 +27,7 @@ android.enableAppCompileTimeRClass=true android.usesSdkInManifest.disallowed=true android.uniquePackageNames=true android.dependency.useConstraints=false +android.enableR8.fullMode=true android.r8.strictFullModeForKeepRules=true android.r8.optimizedResourceShrinking=true android.builtInKotlin=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c816c833..261f2dfc 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] aboutLibraries = "14.2.0" acra = "5.13.1" -agp = "9.1.1" +agp = "9.2.1" auto-service = "1.1.1" autoServiceKsp = "1.2.0" desugar_jdk_libs = "2.1.5"