0
votes

I'm integrating a native android video player(castlabs video player) for my flutter project for DRM support in native android. I'm already using video_player flutter plugin for playing some videos in background. Both of these players are using Exoplayer as a dependency, which is causing duplicate dependency error. castlabs sdk is integrated as an offline maven repo. I can see that it's using exoplayer from the local. Hence I'm unable to change the Exoplayer version in it.

How can we fix the duplicate dependency problem? I'm getting the following error:

Duplicate class com.google.android.exoplayer2.BasePlayer found in modules classes.jar (com.google.android.exoplayer:exoplayer-core:2.9.6) and classes.jar (com.google.android.exoplayer:library-core:r2.10.4-cl-4d4f5be)

(I'm an iOS developer and I'm not proficient in Android).

Thanks.

1

1 Answers

1
votes

this problem occurs when two libraries have the same class, you can easily solve this problem by excluding the class causing the issue from one of the libraries, like so:

dependencies {
   implementation('some-library') {
        exclude group: 'com.example.imgtools', module: 'native'
    }
}

In your case you'll have to exclude com.google.android.exoplayer2.BasePlayer from either com.google.android.exoplayer:exoplayer-core:2.9.6 or com.google.android.exoplayer:library-core:r2.10.4-cl-4d4f5be

I've never used this library but by looking at this page I think you're implementing the same library twice, I suggest you check that again.

Source: https://developer.android.com/studio/build/dependencies#exclude_dependencies

Hope this helps! :)