plugins { id 'com.android.application' } android { compileSdk 32 configurations { extractForNativeBuild } defaultConfig { applicationId "cn.org.wenet.wekws" minSdk 21 targetSdk 32 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { targets "wekws" } } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } externalNativeBuild { cmake { path "src/main/cpp/CMakeLists.txt" } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { implementation 'androidx.appcompat:appcompat:1.3.0' implementation 'com.google.android.material:material:1.4.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'com.microsoft.onnxruntime:onnxruntime-mobile:latest.release' extractForNativeBuild 'com.microsoft.onnxruntime:onnxruntime-mobile:latest.release' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' } task extractAARForNativeBuild { doLast { configurations.extractForNativeBuild.files.each { def file = it.absoluteFile copy { from zipTree(file) into "$buildDir/$file.name" include "headers/**" include "jni/**" } } } } tasks.whenTaskAdded { task -> if (task.name.contains('externalNativeBuild')) { task.dependsOn(extractAARForNativeBuild) } }