Skip to content

Commit

Permalink
build: enable app shrinking for release build type
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiredPlanck committed Feb 11, 2025
1 parent efd0c83 commit 2fdbff5
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ android {

buildTypes {
release {
isMinifyEnabled = false
// proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-android.txt"
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
signingConfig =
project.signKeyFile?.let {
signingConfigs.create("release") {
Expand Down
31 changes: 31 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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

# disable obfuscation
-dontobfuscate

# Keep JNI interface
-keep class com.osfans.trime.core.* { *; }

# remove kotlin null checks
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
static void checkNotNull(...);
static void checkExpressionValueIsNotNull(...);
static void checkNotNullExpressionValue(...);
static void checkReturnedValueIsNotNull(...);
static void checkFieldIsNotNull(...);
static void checkParameterIsNotNull(...);
static void checkNotNullParameter(...);
}

# 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

0 comments on commit 2fdbff5

Please sign in to comment.