JitPack fix worked; two new failures surfaced, both fixed here: 1) checkDebugDuplicateClasses: LiveKit 2.29.2 already BUNDLES a fork (com.github.davidliu:audioswitch) carrying the same com.twilio.audioswitch classes at runtime, so our explicit `implementation com.twilio:audioswitch` put both on the runtime classpath. Switch it to `compileOnly` — we get the AudioDevice types at compile time, runtime uses only LiveKit's bundled fork. (Also clears the "namespace used in multiple modules" merge warning.) 2) CallMedia.kt: `Unresolved reference: AudioOptions`. In 2.29.2 AudioOptions is declared in package io.livekit.android (inside LiveKitOverrides.kt), not io.livekit.android.audio. Corrected the import. Verified AudioSwitchHandler's API (registerAudioDeviceChangeListener / availableAudioDevices / selectedAudioDevice / selectDevice) against the v2.29.2 source. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
98 lines
5.1 KiB
Groovy
98 lines
5.1 KiB
Groovy
// Android build for the native-call plugin. Mirrors the official @capacitor/* plugin module layout (see
|
|
// node_modules/@capacitor/status-bar/android/build.gradle) so it drops into the CI-generated app like the
|
|
// plugins that already build.
|
|
//
|
|
// INCREMENT 2 adds native LiveKit call media (background audio + Speaker/Bluetooth routing), which is a Kotlin +
|
|
// coroutines SDK — so this module now also applies kotlin-android (the ring/plugin glue stays Java). Capacitor
|
|
// pulls the Kotlin stdlib via a BOM but does NOT apply the Kotlin Gradle plugin at the root, so we bring it here
|
|
// (the standard community-plugin pattern); the classpath is additive to the generated root's AGP.
|
|
ext {
|
|
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.12.0'
|
|
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
|
|
// Same FCM version the @capacitor/push-notifications plugin pulls in, so we don't fork the Firebase version.
|
|
firebaseMessagingVersion = project.hasProperty('firebaseMessagingVersion') ? rootProject.ext.firebaseMessagingVersion : '23.3.1'
|
|
// Follow the project's Kotlin (Capacitor pins kotlin_version at the root); fall back to a recent stable.
|
|
bzcKotlinVersion = rootProject.hasProperty('kotlin_version') ? rootProject.ext.kotlin_version : '1.9.24'
|
|
// LiveKit Android SDK — native background call media (Increment 2). Pinned; bump deliberately.
|
|
livekitVersion = '2.29.2'
|
|
audioswitchVersion = '1.2.0'
|
|
coroutinesVersion = '1.8.1'
|
|
}
|
|
|
|
buildscript {
|
|
ext.bzc_kotlin = rootProject.hasProperty('kotlin_version') ? rootProject.ext.kotlin_version : '1.9.24'
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:8.2.1'
|
|
// Kotlin Gradle plugin so this module can compile the .kt LiveKit wrapper. Additive to the root's AGP.
|
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$bzc_kotlin"
|
|
}
|
|
}
|
|
|
|
apply plugin: 'com.android.library'
|
|
apply plugin: 'kotlin-android'
|
|
|
|
android {
|
|
namespace "com.bizgaze.connect.nativecall"
|
|
// LiveKit 2.29 compiles against a recent platform; honor the CI root (Capacitor 8 = 35) and floor at 35.
|
|
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
|
|
defaultConfig {
|
|
// LiveKit Android's floor. The app min is bumped to 24 in CI (android-patch.js) so the merge holds.
|
|
minSdkVersion 24
|
|
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
|
|
versionCode 1
|
|
versionName "1.0"
|
|
}
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
}
|
|
}
|
|
lintOptions {
|
|
abortOnError false
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_17
|
|
targetCompatibility JavaVersion.VERSION_17
|
|
}
|
|
kotlinOptions {
|
|
jvmTarget = '17'
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
// LiveKit pulls transitive artifacts (its WebRTC fork) that live on JitPack.
|
|
maven { url 'https://jitpack.io' }
|
|
}
|
|
|
|
dependencies {
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
implementation project(':capacitor-android')
|
|
// The Biz Connect call-wake FirebaseMessagingService extends the @capacitor/push-notifications one so a
|
|
// single service handles BOTH regular push (forwarded via super) and call-wake data messages.
|
|
implementation project(':capacitor-push-notifications')
|
|
implementation "androidx.core:core:$androidxCoreVersion"
|
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
// RemoteMessage / FirebaseMessaging (transitive from the push plugin, but declared so this module compiles
|
|
// against it directly; same version → no resolution conflict).
|
|
implementation "com.google.firebase:firebase-messaging:$firebaseMessagingVersion"
|
|
// Kotlin + coroutines for the native LiveKit media wrapper (CallMedia.kt).
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$bzcKotlinVersion"
|
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
|
|
// Native call media (background audio) + audio-device routing (speaker/bluetooth/earpiece).
|
|
implementation "io.livekit:livekit-android:$livekitVersion"
|
|
// AudioDevice types (com.twilio.audioswitch.AudioDevice) used by our CallMedia.kt. LiveKit already BUNDLES a
|
|
// fork (com.github.davidliu:audioswitch) that ships these exact classes at RUNTIME — so declaring our own as
|
|
// `implementation` put both forks on the runtime classpath and failed checkDebugDuplicateClasses. Use
|
|
// `compileOnly`: twilio:audioswitch gives us the types at compile time, while runtime uses only LiveKit's
|
|
// bundled fork (binary-identical package/classes) → no duplicate.
|
|
compileOnly "com.twilio:audioswitch:$audioswitchVersion"
|
|
}
|