import com.google.protobuf.gradle.* plugins { id("com.android.library") id("org.jetbrains.kotlin.android") id("com.google.protobuf") } android { namespace = "com.yunqiinnovation.azure_speech" compileSdk = 35 defaultConfig { minSdk = 21 } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } sourceSets { getByName("main") { manifest.srcFile("src/main/AndroidManifest.xml") java.srcDirs("src/main/kotlin") proto { srcDir("src/main/protos") } } } // 添加lint选项 lintOptions { isCheckReleaseBuilds = false } // 添加packaging配置,排除冲突文件 packaging { resources { excludes.add("META-INF/DEPENDENCIES") excludes.add("META-INF/LICENSE") excludes.add("META-INF/LICENSE.txt") excludes.add("META-INF/license.txt") excludes.add("META-INF/NOTICE") excludes.add("META-INF/NOTICE.txt") excludes.add("META-INF/notice.txt") excludes.add("META-INF/*.kotlin_module") } } } // 显式设置Kotlin JVM目标版本 tasks.withType { kotlinOptions { jvmTarget = "11" } } dependencies { // 添加Microsoft语音SDK implementation("com.microsoft.cognitiveservices.speech:client-sdk:1.48.1") implementation(project(":speech")) implementation("com.squareup.okhttp3:okhttp:4.12.0") implementation("com.google.protobuf:protobuf-javalite:3.25.1") add("compileOnly", project(":ble_service")) // 通话翻译 PCM 原生直连桥:直接给 bluetooth_manager 的 tap 槽赋值 / 直喂它的下行发送器(见 BesCallPcmBridge.kt) add("compileOnly", project(":bluetooth_manager")) // gRPC val grpcVersion = "1.57.2" implementation("io.grpc:grpc-android:$grpcVersion") implementation("io.grpc:grpc-okhttp:$grpcVersion") implementation("io.grpc:grpc-protobuf-lite:$grpcVersion") implementation("io.grpc:grpc-stub:$grpcVersion") implementation("javax.annotation:javax.annotation-api:1.3.2") } protobuf { protoc { artifact = "com.google.protobuf:protoc:3.25.1" } plugins { id("grpc") { artifact = "io.grpc:protoc-gen-grpc-java:1.57.2" } } generateProtoTasks { all().forEach { task -> task.builtins { id("java") { option("lite") } } task.plugins { id("grpc") { option("lite") } } } } }