webrtc-android icon indicating copy to clipboard operation
webrtc-android copied to clipboard

Duplicate class found in modules

Open nodinosaur opened this issue 8 months ago • 2 comments
trafficstars

I am developing an Android app using Kotlin and encountering a duplicate class error related to WebRTC. Both GeckoView and Stream WebRTC include WebRTC classes directly inside their respective AAR files, causing conflicts. Example Error Message:

Duplicate class org.webrtc.audio.JavaAudioDeviceModule$AudioTrackStartErrorCode found in modules
geckoview-135.0.20250216192613.aar -> geckoview-135.0.20250216192613-runtime (org.mozilla.geckoview:geckoview:135.0.20250216192613)
and
stream-webrtc-android-1.3.8.aar -> stream-webrtc-android-1.3.8-runtime (io.getstream:stream-webrtc-android:1.3.8)

Not sure how to get around this. Another issue is that Mozilla's GeckoView and Stream have different subsets of WebRTC, so excluding Streams module

implementation("io.getstream:stream-webrtc-android-ktx:$streamWebRtcVersion") {
    exclude(group = "io.getstream", module = "stream-webrtc-android")
}

Doesn't really help because certain classes like PeerConnection are missing from GeckoView

nodinosaur avatar Mar 01 '25 13:03 nodinosaur

👀 @nodinosaur - Let me know if we can help with anything :)

Nash0x7E2 avatar Mar 01 '25 23:03 Nash0x7E2

Thank you Nash.

Found a workaround for the duplicate classes issue as it clashes with Mozilla's GeckoView which also embeds org.webrtc so maybe this should be documented:

val streamWebRtcVersion = "1.3.8"
//implementation("io.getstream:stream-webrtc-android:$streamWebRtcVersion") // this is `org.webrtc`
implementation("io.getstream:stream-webrtc-android-ktx:$streamWebRtcVersion") {
    exclude(group = "io.getstream", module = "stream-webrtc-android")
}
implementation("io.getstream:stream-webrtc-android-ui:$streamWebRtcVersion") {
    exclude(group = "io.getstream", module = "stream-webrtc-android")
}

But the original issue remains; I can't call on WebRTC classes

nodinosaur avatar Mar 02 '25 00:03 nodinosaur