question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Duplicate class found

See original GitHub issue

✍️ Describe the bug

I’m using Chucker in an android library and also in another app that depended on the library. When I add the library as a dependency for the App. I get a conflict issue that tells me that all chucker classes are defined twice.

Duplicate class com.chuckerteam.chucker.api.ChuckerCollector found in modules jetified-library-3.5.2-runtime (com.github.chuckerteam.chucker:library:3.5.2) and jetified-library-no-op-3.5.2-runtime (com.github.chuckerteam.chucker:library-no-op:3.5.2)

🔧 Expected behavior

I expect that I can use chucker within different modules without compilation errors

📷 Screenshots

The modules define chucker as following

This is how I define chucker in the library Screen Shot 2021-12-23 at 6 03 55 PM

Build types of the library Screen Shot 2021-12-23 at 6 04 29 PM

Build types of the app Screen Shot 2021-12-23 at 6 07 47 PM

The App has the following flavors Screen Shot 2021-12-23 at 6 08 55 PM

How I define the library inside the app Screen Shot 2021-12-23 at 6 09 43 PM

📱 Tech info

  • Chucker version: 3.5.2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
MiSikoracommented, Dec 25, 2021

Glad to hear that you resolved the issue. 🎉

but I would say that it will be better if chucker has only one dependency

I agree in principle, but there are some valid concerns for not publishing the no-op variant. It basically boils down to ease of configuration, the overall UX, and security a bit. But if you feel strongly about it I encourage you to create an issue where it’s more visible and everyone can participate in the discussion.

1reaction
MiSikoracommented, Dec 23, 2021

I’m using Chucker in an android library and also in another app that depended on the library.

If I understood this correctly, you’re saying that Chucker is also applied in the application, but I don’t see that from the attached screenshots. Am I getting something wrong?

Besides that, there shouldn’t be any issues if a unique library variant is on a classpath of each build variant. Would you mind checking if it isn’t a Gradle issue? A similar problem was reported in the past. https://github.com/ChuckerTeam/chucker/issues/666

If different library variants are applied from the library and directly to the application, then build failures are by design, and it is something you’d have to resolve on your part. Perhaps this thread might be helpful - https://github.com/ChuckerTeam/chucker/issues/362.

If none of this is helpful, you’d have to provide us with a sample project that reproduces this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Duplicate class found" - IntelliJ and .class files - Stack Overflow
I do see the files, the problem is that I see every file twice (IntelliJ displays both the .java and the .class )....
Read more >
Disable or suppress "Duplicate class found" warnings/errors
IDE reports the error in this case because having duplicated source files in compiler path will lead to not-compilable code. To fix this...
Read more >
Duplicate class found in modules (different versions of same ...
Resolved Duplicate class found in modules (different versions of same library imported by different plugins).
Read more >
module producing duplicate classes in build/.transforms ...
So, the error message is right, I do have duplicate classes! A dex file is produced for every class in my module and...
Read more >
How to avoid duplicate classes for build types ? - Google Groups
The source code for Build Types (and flavors) is not meant to replace classes from src/main. It's just an additional folder. You could...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found