diff --git a/runtime/android/app/build.gradle b/runtime/android/app/build.gradle new file mode 100644 index 0000000..e8cc987 --- /dev/null +++ b/runtime/android/app/build.gradle @@ -0,0 +1,75 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 32 + + configurations { + extractForNativeBuild + } + + defaultConfig { + applicationId "cn.org.wenet.wetts" + minSdk 21 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + externalNativeBuild { + cmake { + targets "wetts" + } + } + } + + 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-android:1.15.1' + extractForNativeBuild 'com.microsoft.onnxruntime:onnxruntime-android:1.15.1' + implementation 'com.github.pengzhendong:wenet-openfst-android:1.0.2' + extractForNativeBuild 'com.github.pengzhendong:wenet-openfst-android:1.0.2' + 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) + } +} diff --git a/runtime/android/build.gradle b/runtime/android/build.gradle new file mode 100644 index 0000000..5ae9a7b --- /dev/null +++ b/runtime/android/build.gradle @@ -0,0 +1,9 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id 'com.android.application' version '7.2.2' apply false + id 'com.android.library' version '7.2.2' apply false +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file