Master Zzzing
Master Zzzing

Reputation: 563

Android build.gradle Exclude duplicate classes

In this project, I need to integrate two libraries Bitmovin and Purchasely. After I added those two dependencies, the app can not run due to a conflict between bitmovin and puchasely library. I know there's one way to solve this by excluding all those duplicate classes. Unfortunately, I'm not familiar with this term and can not figure out what is the group name and module name to exclude. Also, I'm not sure which dependency that I should use "exclude" with.

implementation ("com.bitmovin.player:playercore:2.64.0"){
   exclude group: 'group_name', module: 'module_name'
}
implementation ("io.purchasely:core:2.4.5"){
   exclude group: 'group_name', module: 'module_name'
}

If I successfully remove the duplication classes, would it cause any one of the libraries to stop working or break at run time?

Build failed log enter image description here

These should be the duplicate classes enter image description here

Upvotes: 3

Views: 6546

Answers (1)

Kerwan
Kerwan

Reputation: 1198

You can find all the dependencies of your project with the command

./gradlew :app:dependencies

Bitmovin and Purchasely seems to both use exoplayer. So to avoid conflicts you can remove the module exoplayer from either one of those dependencies.

In your case, I think you should remove it from Purchasely

implementation ("io.purchasely:core:2.4.7") {
    exclude module: 'exoplayer-core'
    exclude module: 'exoplayer-hls'
    exclude module: 'exoplayer-dash'
    exclude module: 'exoplayer-ui'
    exclude module: 'extension-okhttp'
    exclude module: 'extension-mediasession'
}

Upvotes: 3

Related Questions