Issue
I have a native android project with a lot of submodules and custom flutter library that added as a submodule as well and dependency set up as described here: href="https://docs.flutter.dev/development/add-to-app/android/project-setup#option-b---depend-on-the-modules-source-code" rel="nofollow noreferrer">option B with settings.gradle
the issue is that some submodules are uses exoplayer, and flutter library uses it as well. so, while building I got a lot of dependency issue:
Duplicate class com.google.android.exoplayer2.video.spherical.Projection$SubMesh found in modules jetified-exoplayer-core-2.10.1-runtime (com.amazon.android:exoplayer-core:2.10.1) and jetified-exoplayer-core-2.10.1-runtime (com.google.android.exoplayer:exoplayer-core:2.10.1)
it seems force does not working in this case:
configurations.all {
resolutionStrategy.force 'com.google.android.exoplayer:exoplayer-core:2.10.1'
}
how can I exclude exoplayer from flutter lib?
Only option I found for now is to build .arr and exclude from here, but it not working for me as flutter library also is in development.
Solution
replace
implementation project(':flutter')
with
implementation(project(":flutter")) {
exclude module: 'exoplayer-core'
exclude module: 'exoplayer-hls'
exclude module: 'exoplayer-dash'
exclude module: 'exoplayer-smoothstreaming'
}
"(" and ")" around "project" is required
Answered By - Siarhei
Answer Checked By - Pedro (JavaFixing Volunteer)