build: 启用 R8 压缩与资源优化,添加 ProGuard 规则
- androidApp: 启用 isMinifyEnabled 和 isShrinkResources - androidApp: ABI 过滤(arm64-v8a, armeabi-v7a),关闭 buildConfig - gradle.properties: 启用并行构建、守护进程、R8 fullMode - 新建 proguard-rules.pro 保留 KMP/Compose/kotlinx.datetime 规则 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e0b7700306
commit
ba742f1597
@ -14,7 +14,28 @@ android {
|
||||
targetSdk = libs.versions.android.targetSdk.get().toInt()
|
||||
versionCode = 1
|
||||
versionName = "1.0"
|
||||
|
||||
ndk {
|
||||
abiFilters += listOf("arm64-v8a", "armeabi-v7a")
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
buildConfig = false
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
20
androidApp/proguard-rules.pro
vendored
Normal file
20
androidApp/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
# Kotlin Metadata (required for KMP)
|
||||
-keep class kotlin.Metadata { *; }
|
||||
-keepattributes *Annotation*, Signature, InnerClasses, EnclosingMethod
|
||||
|
||||
# kotlinx.datetime
|
||||
-keep class kotlinx.datetime.** { *; }
|
||||
|
||||
# tyme4kt (Chinese traditional calendar)
|
||||
-keep class cn.tyme.** { *; }
|
||||
|
||||
# Compose runtime reflective lookups
|
||||
-keep class androidx.compose.runtime.** { *; }
|
||||
|
||||
# ViewModel (used by CalendarViewModel)
|
||||
-keep class * extends androidx.lifecycle.ViewModel { *; }
|
||||
|
||||
# Keep entry point composables referenced by string name
|
||||
-keepclassmembers class * {
|
||||
@androidx.compose.runtime.Composable <methods>;
|
||||
}
|
||||
@ -6,11 +6,14 @@ kotlin.daemon.jvmargs=-Xmx3072M
|
||||
org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
org.gradle.daemon=true
|
||||
|
||||
#Android
|
||||
android.nonTransitiveRClass=true
|
||||
android.useAndroidX=true
|
||||
android.uniquePackageNames=false
|
||||
android.dependency.useConstraints=true
|
||||
android.r8.strictFullModeForKeepRules=false
|
||||
android.r8.strictFullModeForKeepRules=true
|
||||
android.generateSyncIssueWhenLibraryConstraintsAreEnabled=false
|
||||
android.enableR8.fullMode=true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user