group 'com.devac.whisper_flutter' version '1.0' buildscript { repositories { google() mavenCentral() } dependencies { // The Android Gradle Plugin knows how to build native code with the NDK. classpath 'com.android.tools.build:gradle:8.4.2' } } rootProject.allprojects { repositories { google() mavenCentral() } } apply plugin: 'com.android.library' android { namespace "com.devac.whisper_ggml" ndkVersion "29.0.13113456" compileSdk 36 // Invoke the shared CMake build with the Android Gradle Plugin. externalNativeBuild { cmake { path "src/whisper/CMakeLists.txt" version "3.22.1" } } compileOptions { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 } defaultConfig { minSdkVersion 21 // Merged into consuming apps' R8 config: without these, release // builds can strip the bundled ffmpeg-kit classes, whose failed // registration aborts the plugin registrant and breaks unrelated // plugin channels (e.g. path_provider). See issue #16. consumerProguardFiles 'consumer-rules.pro' ndk { // Flutter does not currently support building for x86 Android (See Issue 9253). abiFilters("armeabi-v7a", "x86_64", "arm64-v8a", "x86") } externalNativeBuild { cmake { // No thin-LTO: with the full whisper.cpp v1.9.1 source tree // it multiplies link time for no meaningful size win. cFlags "-O3 -ffunction-sections -fdata-sections" cppFlags "-O3 -ffunction-sections -fdata-sections" arguments "-DANDROID_STL=c++_static", "-DCMAKE_BUILD_TYPE=Release" } } } }