From d6fc15526c545e0c9746cb4baebff1168d18affe Mon Sep 17 00:00:00 2001 From: LZX <1820455493@qq.com> Date: Sun, 8 Nov 2026 15:44:03 +0800 Subject: [PATCH] perf: enable R8 code and resource shrinking without obfuscation --- app/build.gradle.kts | 7 ++++--- app/proguard-rules.pro | 31 +++++++++++++------------------ 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 5099cc3..50f030f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -11,8 +11,8 @@ android { applicationId = "com.lzxnone.tailscalemanager" minSdk = 28 targetSdk = 36 - versionCode = 100 - versionName = "1.0.0" + versionCode = 101 + versionName = "1.0.1" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } @@ -31,7 +31,8 @@ android { buildTypes { release { - isMinifyEnabled = false + isMinifyEnabled = true + isShrinkResources = true if (keystoreFile.exists()) { signingConfig = signingConfigs.getByName("release") } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb43..004dce8 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,21 +1,16 @@ -# 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 +# 仅代码裁剪(Tree Shaking),完全禁用重命名混淆 +-dontobfuscate +-dontoptimize -# 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 *; -#} +# 保留调试堆栈信息与注解签名 +-keepattributes SourceFile,LineNumberTable,InnerClasses,EnclosingMethod,Exceptions,Signature -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable +# 保持数据模型与核心接口结构 +-keep class com.lzxnone.tailscalemanager.model.** { *; } -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +# 保持 Android 基本组件 +-keep public class * extends android.app.Activity +-keep public class * extends android.app.Application +-keep public class * extends android.app.Service +-keep public class * extends android.content.BroadcastReceiver +-keep public class * extends android.content.ContentProvider