'Flutter better_player android Duplicate class found in modules jetified-exoplayer-core-2.17.0-runtime.jar and jetified-exoplayer-ui-2.15.1-runtime.jar
When running Flutter build apk with version 0.0.81 the following error is thrown
1 exception was raised by workers: java.lang.RuntimeException: Duplicate class com.google.android.exoplayer2.ui.DownloadNotificationHelper found in modules jetified-exoplayer-core-2.17.0-runtime.jar (com.google.android.exoplayer:exoplayer-core:2.17.0) and jetified-exoplayer-ui-2.15.1-runtime.jar (com.google.android.exoplayer:exoplayer-ui:2.15.1)[BUG]
I tried to exclude the module and group in android's build.gradle and still it does not work. My pubspec.yaml environment: sdk: ">=2.7.0 <3.0.0"
So how can I use better_player: 0.0.81
Solution 1:[1]
Had the same issue, apparently the issue is that I was using video_player (2.3.0) and better_player (0.0.81). video_player depends on exoplayer 2.17 while better_player depends on exoplayer 2.15. I downgraded video_player to 2.1.12 (in pubspec.yaml you may need to write video_player: 2.1.12
WITHOUT ^
).
Solution 2:[2]
Fixed it by adding
implementation ('com.google.android.exoplayer:exoplayer:2.17.0')
at dependencies in /android/app/build.gradle
dependencies {
....
implementation ('com.google.android.exoplayer:exoplayer:2.17.0')
}
Solution 3:[3]
Had the same issue and I solve it by using an old version of pubspec.lock
and cleaning the cache with flutter clean
and flutter pub cache clean
and running flutter pub get
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Julian |
Solution 2 | eclat_soft |
Solution 3 | Yassin Saddem |