lib: enable app optimization

This commit is contained in:
Han Yin 2025-10-31 18:29:08 -07:00
parent 33987b56fa
commit e76554304d
5 changed files with 27 additions and 12 deletions

View File

@ -23,8 +23,17 @@ android {
} }
buildTypes { buildTypes {
debug {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android.txt"),
"proguard-rules.pro"
)
}
release { release {
isMinifyEnabled = false isMinifyEnabled = true
isShrinkResources = true
proguardFiles( proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro" "proguard-rules.pro"

View File

@ -19,3 +19,11 @@
# If you keep the line number information, uncomment this to # If you keep the line number information, uncomment this to
# hide the original source file name. # hide the original source file name.
#-renamesourcefileattribute SourceFile #-renamesourcefileattribute SourceFile
-keep class com.arm.aichat.* { *; }
-keep class com.arm.aichat.gguf.* { *; }
-assumenosideeffects class android.util.Log {
public static int v(...);
public static int d(...);
}

View File

@ -39,16 +39,6 @@ android {
minCompileSdk = 35 minCompileSdk = 35
} }
} }
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
externalNativeBuild { externalNativeBuild {
cmake { cmake {
path("src/main/cpp/CMakeLists.txt") path("src/main/cpp/CMakeLists.txt")

View File

@ -0,0 +1,8 @@
-keep class com.arm.aichat.* { *; }
-keep class com.arm.aichat.gguf.* { *; }
-keepclasseswithmembernames class * {
native <methods>;
}
-keep class kotlin.Metadata { *; }

View File

@ -16,7 +16,7 @@
#ifndef LOG_MIN_LEVEL #ifndef LOG_MIN_LEVEL
#if defined(NDEBUG) #if defined(NDEBUG)
#define LOG_MIN_LEVEL ANDROID_LOG_WARN #define LOG_MIN_LEVEL ANDROID_LOG_INFO
#else #else
#define LOG_MIN_LEVEL ANDROID_LOG_VERBOSE #define LOG_MIN_LEVEL ANDROID_LOG_VERBOSE
#endif #endif