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
Build types of the library
Build types of the app
The App has the following flavors
How I define the library inside the app
📱 Tech info
- Chucker version: 3.5.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (4 by maintainers)
Top GitHub Comments
Glad to hear that you resolved the issue. 🎉
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.
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.