android(call): fix LiveKit audio API import + audioswitch duplicate-class
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>
This commit is contained in:
1 parent
7cd3c3afff
commit
ea4d65274e
2 files changed
+7
-3
No files matched your search
@@ -88,6 +88,10 @@ dependencies {
|
|||||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
|
||||||
// Native call media (background audio) + audio-device routing (speaker/bluetooth/earpiece).
|
// Native call media (background audio) + audio-device routing (speaker/bluetooth/earpiece).
|
||||||
implementation "io.livekit:livekit-android:$livekitVersion"
|
implementation "io.livekit:livekit-android:$livekitVersion"
|
||||||
// AudioDevice types used by LiveKit's AudioSwitchHandler; declared so they're on our compile classpath.
|
// AudioDevice types (com.twilio.audioswitch.AudioDevice) used by our CallMedia.kt. LiveKit already BUNDLES a
|
||||||
implementation "com.twilio:audioswitch:$audioswitchVersion"
|
// 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"
|
||||||
}
|
}
|
||||||
+1
-1
@@ -5,7 +5,7 @@ import android.util.Log
|
|||||||
import com.twilio.audioswitch.AudioDevice
|
import com.twilio.audioswitch.AudioDevice
|
||||||
import io.livekit.android.LiveKit
|
import io.livekit.android.LiveKit
|
||||||
import io.livekit.android.LiveKitOverrides
|
import io.livekit.android.LiveKitOverrides
|
||||||
import io.livekit.android.audio.AudioOptions
|
import io.livekit.android.AudioOptions
|
||||||
import io.livekit.android.audio.AudioSwitchHandler
|
import io.livekit.android.audio.AudioSwitchHandler
|
||||||
import io.livekit.android.room.Room
|
import io.livekit.android.room.Room
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
|||||||
Reference in new issue
Block a user