diff --git a/examples/llama.android/app/build.gradle.kts b/examples/llama.android/app/build.gradle.kts index f2e630dd93..3524fe39c4 100644 --- a/examples/llama.android/app/build.gradle.kts +++ b/examples/llama.android/app/build.gradle.kts @@ -23,8 +23,17 @@ android { } buildTypes { + debug { + isMinifyEnabled = true + isShrinkResources = true + proguardFiles( + getDefaultProguardFile("proguard-android.txt"), + "proguard-rules.pro" + ) + } release { - isMinifyEnabled = false + isMinifyEnabled = true + isShrinkResources = true proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" diff --git a/examples/llama.android/app/proguard-rules.pro b/examples/llama.android/app/proguard-rules.pro index f1b424510d..358020d2d2 100644 --- a/examples/llama.android/app/proguard-rules.pro +++ b/examples/llama.android/app/proguard-rules.pro @@ -19,3 +19,11 @@ # If you keep the line number information, uncomment this to # hide the original source file name. #-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(...); +} diff --git a/examples/llama.android/lib/build.gradle.kts b/examples/llama.android/lib/build.gradle.kts index eec80d1f88..263fee6068 100644 --- a/examples/llama.android/lib/build.gradle.kts +++ b/examples/llama.android/lib/build.gradle.kts @@ -39,16 +39,6 @@ android { minCompileSdk = 35 } } - - buildTypes { - release { - isMinifyEnabled = false - proguardFiles( - getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro" - ) - } - } externalNativeBuild { cmake { path("src/main/cpp/CMakeLists.txt") diff --git a/examples/llama.android/lib/consumer-rules.pro b/examples/llama.android/lib/consumer-rules.pro index e69de29bb2..e6eb6f5474 100644 --- a/examples/llama.android/lib/consumer-rules.pro +++ b/examples/llama.android/lib/consumer-rules.pro @@ -0,0 +1,8 @@ +-keep class com.arm.aichat.* { *; } +-keep class com.arm.aichat.gguf.* { *; } + +-keepclasseswithmembernames class * { + native ; +} + +-keep class kotlin.Metadata { *; } diff --git a/examples/llama.android/lib/src/main/cpp/logging.h b/examples/llama.android/lib/src/main/cpp/logging.h index aa85ce613c..2e768d2beb 100644 --- a/examples/llama.android/lib/src/main/cpp/logging.h +++ b/examples/llama.android/lib/src/main/cpp/logging.h @@ -16,7 +16,7 @@ #ifndef LOG_MIN_LEVEL #if defined(NDEBUG) -#define LOG_MIN_LEVEL ANDROID_LOG_WARN +#define LOG_MIN_LEVEL ANDROID_LOG_INFO #else #define LOG_MIN_LEVEL ANDROID_LOG_VERBOSE #endif