tweet_ui icon indicating copy to clipboard operation
tweet_ui copied to clipboard

Duplicate classes when compiling

Open zeroregard opened this issue 3 years ago • 9 comments

Describe the bug When I import tweet_ui in pubspec.yaml and do 'flutter run', I see this error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class com.google.android.exoplayer2.ui.package-info found in modules jetified-exoplayer-common-2.14.1-runtime.jar (com.google.android.exoplayer:exoplayer-common:2.14.1) and jetified-exoplayer-ui-2.13.3-runtime.jar (com.google.android.exoplayer:exoplayer-ui:2.13.3)

  Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.     


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 16s
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        17.4s
Exception: Gradle task assembleDebug failed with exit code 1

To Reproduce Steps to reproduce the behavior:

  1. Checkout v2 branch at https://github.com/dasmikko/knocky/tree/v2
  2. Do 'flutter run' in checked out repo

Expected behavior App compiles and runs

Smartphone (please complete the following information):

  • Device: OnePlus 7T Pro
  • OS: Android
  • Version 11.0.1.1.HD01BA

Additional context Looks like this is a matter of the Android version or even just the phone. Any pointers on what's wrong would be great, I'm assuming we're colliding with another library but it's hard for me to see which.

zeroregard avatar Aug 01 '21 11:08 zeroregard

Hi @zeroregard . Try to set your better_player version to the one that I use in my library - better_player: ^0.0.63 as an AdHoc solution. I'm currently on my 2 week holiday so I won't be able to check this thoroughly. When I get back I will try to check this.

kawa89 avatar Aug 01 '21 11:08 kawa89

@zeroregard did it help?

kawa89 avatar Aug 03 '21 09:08 kawa89

For me, pinning better_player: 0.0.63 was insufficient to solve this problem. I also had to pin video_player:

  tweet_ui: ^3.0.0
  
  better_player: 0.0.63

  video_player: 2.0.2
  video_player_platform_interface: 4.0.0

After that, the app compiled successfully.

Any reason this library depends on both better_player and video_player? I think the root issue is that both of those libraries depend on ExoPlayer, and since ExoPlayer is an Android library, the dart dependency resolution is a bit challenging.

ndahlquist avatar Aug 05 '21 21:08 ndahlquist

Only pinning better_player does not work, but ndahlquist's solution does. I get this error though, but it compiles nonetheless:

$ flutter run
Running "flutter pub get" in knocky...                             774ms
Launching lib\main.dart on HD1913 in debug mode...
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\better_player-0.0.63\android\src\main\java\com\jhomlala\better_player\BetterPlayerPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.                
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        22.2s
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk...                 3.8s

zeroregard avatar Aug 08 '21 12:08 zeroregard

@kawa89 I think video_player dependency is not used and can be removed?

wszeborowskimateusz avatar Feb 15 '22 09:02 wszeborowskimateusz

Hello!

I have duplicate classes error with latest versions of video_player (2.3.0) in tweet_ui (3.0.1) after upgrading flutter to 2.10 and upgrading dependencies in my project:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.google.android.exoplayer2.ui.DownloadNotificationHelper found in modules jetified-exoplayer-core-2.17.0-runtime (com.google.android.exoplayer:exoplayer-core:2.17.0) and jetified-exoplayer-ui-2.15.1-runtime (com.google.android.exoplayer:exoplayer-ui:2.15.1)

     Go to the documentation to learn how to <a href="d.android.com[/r/tools/classpath-sync-errors]()">Fix dependency resolution errors<[/a]()>.

How I can fix that?

prilepskiy avatar Mar 30 '22 07:03 prilepskiy

@prilepskiy Did you try a workaround from this command? https://github.com/schibsted/tweet_ui/issues/68#issuecomment-893818137

wszeborowskimateusz avatar Mar 30 '22 14:03 wszeborowskimateusz

Also soon, we should get rid of better_player (in this https://github.com/schibsted/tweet_ui/issues/78 issue when we gonna introduce web support).

wszeborowskimateusz avatar Mar 30 '22 14:03 wszeborowskimateusz

@prilepskiy Could you try on the newest version - 4.0.0?

wszeborowskimateusz avatar Apr 09 '22 08:04 wszeborowskimateusz