Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate classes when compiling #68

Open
zeroregard opened this issue Aug 1, 2021 · 9 comments · Fixed by #84
Open

Duplicate classes when compiling #68

zeroregard opened this issue Aug 1, 2021 · 9 comments · Fixed by #84
Labels
bug Something isn't working

Comments

@zeroregard
Copy link

zeroregard commented Aug 1, 2021

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 zeroregard added the bug Something isn't working label Aug 1, 2021
@kawa89
Copy link
Collaborator

kawa89 commented Aug 1, 2021

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
Copy link
Collaborator

kawa89 commented Aug 3, 2021

@zeroregard did it help?

@ndahlquist
Copy link
Contributor

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.

@zeroregard
Copy link
Author

zeroregard commented Aug 8, 2021

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

@wszeborowskimateusz
Copy link
Collaborator

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

@wszeborowskimateusz wszeborowskimateusz linked a pull request Feb 16, 2022 that will close this issue
@prilepskiy
Copy link

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?

@wszeborowskimateusz
Copy link
Collaborator

@prilepskiy Did you try a workaround from this command? #68 (comment)

@wszeborowskimateusz
Copy link
Collaborator

Also soon, we should get rid of better_player (in this #78 issue when we gonna introduce web support).

@wszeborowskimateusz
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants