0

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 Answer 1

2

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! :)

Sign up to request clarification or add additional context in comments.

4 Comments

I tried it as follows: implementation ('com.castlabs.player:castlabs-sdk:4.2.24'){ exclude group: 'com.google.android.exoplayer' } But I'm getting the following error: Error: Interface com.google.android.exoplayer2.drm.DrmSession(classpath class) used as super class of com.castlabs.android.player.CastlabsDrmSessionManager$DrmSessionWrapper.
I tried searching on google, unfortunately, I didn't find a clear answer, I suggest you check this link and this link
try exclude group: 'com.google.android.exoplayer', module: 'exoplayer'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.