Skip to content

Commit 3c0ea8a

Browse files
committed
fix/android-debug-inference-issue: Applied BUILD_TYPE=Release to NDK build of whisper.android example
1 parent 0ae02cd commit 3c0ea8a

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

examples/whisper.android/app/build.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,25 @@ android {
2222
}
2323

2424
buildTypes {
25+
debug {
26+
externalNativeBuild {
27+
cmake {
28+
// When the AGP build type is Debug, the native (NDK/CMake) build does not run
29+
// compiler optimizations by default, causing a critical performance issue.
30+
// We force CMAKE_BUILD_TYPE to Release here so native code stays optimized
31+
// even in Debug AGP builds.
32+
arguments "-DCMAKE_BUILD_TYPE=Release"
33+
}
34+
}
35+
}
36+
2537
release {
2638
signingConfig signingConfigs.debug
2739
minifyEnabled true
2840
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2941
}
3042
}
43+
3144
compileOptions {
3245
sourceCompatibility JavaVersion.VERSION_17
3346
targetCompatibility JavaVersion.VERSION_17

0 commit comments

Comments
 (0)