]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
examples : Improved inference performance of Android example project (#3913)
authorYongmin Yoo 유용민 <redacted>
Tue, 30 Jun 2026 10:12:04 +0000 (19:12 +0900)
committerGitHub <redacted>
Tue, 30 Jun 2026 10:12:04 +0000 (12:12 +0200)
* fix/android-debug-inference-issue: Applied BUILD_TYPE=Release to NDK build of whisper.android example

* fix/android-debug-inference-issue: Applied BUILD_TYPE=Release to NDK build of whisper.android.java example

examples/whisper.android.java/app/build.gradle
examples/whisper.android/app/build.gradle

index 543701e1bb1131df12e73749531bf7962cbe5c4f..2dcda0944d818e2739b5643f672dad1c275a93d7 100644 (file)
@@ -25,6 +25,18 @@ android {
   }
 
   buildTypes {
+    debug {
+      externalNativeBuild {
+        cmake {
+          // When the AGP build type is Debug, the native (NDK/CMake) build does not run
+          // compiler optimizations by default, causing a critical performance issue.
+          // We force CMAKE_BUILD_TYPE to Release here so native code stays optimized
+          // even in Debug AGP builds.
+          arguments "-DCMAKE_BUILD_TYPE=Release"
+        }
+      }
+    }
+
     release {
       signingConfig signingConfigs.debug
       minifyEnabled true
index 9f407998cdb395f8929c2ed6892e7e8345a70fd7..9ed13f84527bdec0c742550a34a3f0df0f13cbc0 100644 (file)
@@ -22,12 +22,25 @@ android {
     }
 
     buildTypes {
+        debug {
+            externalNativeBuild {
+                cmake {
+                    // When the AGP build type is Debug, the native (NDK/CMake) build does not run
+                    // compiler optimizations by default, causing a critical performance issue.
+                    // We force CMAKE_BUILD_TYPE to Release here so native code stays optimized
+                    // even in Debug AGP builds.
+                    arguments "-DCMAKE_BUILD_TYPE=Release"
+                }
+            }
+        }
+
         release {
             signingConfig signingConfigs.debug
             minifyEnabled true
             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
         }
     }
+
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_17
         targetCompatibility JavaVersion.VERSION_17