Reputation: 90
Description
I have a blank application that needs chucker to inspect requests and responses.
So I add chucker to dependencies.
debugImplementation "com.github.chuckerteam.chucker:library:4.0.0"
releaseImplementation "com.github.chuckerteam.chucker:library-no-op:4.0.0"
Sync and it runs successfully. But when I tried adding midtrans as payment gateway along with chucker, it breaks.
debugImplementation 'com.midtrans:uikit:2.0.0-SANDBOX'
releaseImplementation 'com.midtrans:uikit:2.0.0'
sync, hit run returns Duplicate class found ...
Error Log
Duplicate class com.chuckerteam.chucker.api.Chucker found in modules library-4.0.0-runtime (com.github.chuckerteam.chucker:library:4.0.0) and library-no-op-3.5.2-runtime (com.github.chuckerteam.chucker:library-no-op:3.5.2)
Duplicate class com.chuckerteam.chucker.api.ChuckerCollector found in modules library-4.0.0-runtime (com.github.chuckerteam.chucker:library:4.0.0) and library-no-op-3.5.2-runtime (com.github.chuckerteam.chucker:library-no-op:3.5.2)
Duplicate class com.chuckerteam.chucker.api.ChuckerInterceptor found in modules library-4.0.0-runtime (com.github.chuckerteam.chucker:library:4.0.0) and library-no-op-3.5.2-runtime (com.github.chuckerteam.chucker:library-no-op:3.5.2)
Duplicate class com.chuckerteam.chucker.api.ChuckerInterceptor$Builder found in modules library-4.0.0-runtime (com.github.chuckerteam.chucker:library:4.0.0) and library-no-op-3.5.2-runtime (com.github.chuckerteam.chucker:library-no-op:3.5.2)
Duplicate class com.chuckerteam.chucker.api.RetentionManager found in modules library-4.0.0-runtime (com.github.chuckerteam.chucker:library:4.0.0) and library-no-op-3.5.2-runtime (com.github.chuckerteam.chucker:library-no-op:3.5.2)
Duplicate class com.chuckerteam.chucker.api.RetentionManager$Period found in modules library-4.0.0-runtime (com.github.chuckerteam.chucker:library:4.0.0) and library-no-op-3.5.2-runtime (com.github.chuckerteam.chucker:library-no-op:3.5.2)
Go to the documentation to learn how to Fix dependency resolution errors.
Github link : https://github.com/ai-null/test-duplication-class
Upvotes: 0
Views: 284
Reputation: 1934
It happens because debugImplementation 'com.midtrans:uikit:2.0.0-SANDBOX'
includes com.github.chuckerteam.chucker:library-no-op
, which conflicts with com.github.chuckerteam.chucker:library
due to their similar packages despite being different libraries.
Please try as follows:
debugImplementation('com.midtrans:uikit:2.0.0-SANDBOX') { exclude group: 'com.github.chuckerteam.chucker', module: 'library-no-op' }
Upvotes: 1