mutlidex: duplicate class okhttp3/Address.class even when all other inclusions of okhttp have been excluded
See original GitHub issueI’ve got an app which uses okhttp in this combination
def okhttp_version = '3.0.0'
compile "com.squareup.okhttp3:okhttp:$okhttp_version"
compile "com.squareup.okhttp3:okhttp-urlconnection:$okhttp_version"
compile "com.squareup.picasso:picasso:2.5.2"
compile "com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.1"
When building the multidex artifact i get
java.util.zip.ZipException: duplicate entry: okhttp3/Address.class
So i thought: well maybe i just have to exclude the transitive dependencies on okhttp and did:
compile "com.squareup.okhttp3:okhttp:$okhttp_version"
compile ("com.squareup.okhttp3:okhttp-urlconnection:$okhttp_version") {
exclude group: "com.squareup.okhttp3"
}
compile "com.squareup.picasso:picasso:2.5.2"
compile ("com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.1") {
exclude group: "com.squareup.okhttp3"
}
But i’m still getting that error… However moving back to okhttp version 3.0.0-RC1 so it looks liek this:
def okhttp_version = '3.0.0-RC1'
compile "com.squareup.okhttp3:okhttp:$okhttp_version"
compile "com.squareup.okhttp3:okhttp-urlconnection:$okhttp_version"
compile "com.squareup.picasso:picasso:2.5.2"
compile "com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.1"
And everything will compile & run fine
Issue Analytics
- State:
- Created 8 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Gradle "Duplicate class" error when adding uCrop and ...
The conflict is due to your both UCrop and CometChat dependencies internally uses okhttp library.To resolve this problem you have to exclude ......
Read more >Open Source License File - VMware
The software contained in this package has been slightly altered, in particular the package has ... Please contact the author if you need...
Read more >Open Source Used In Socio 1.0 - Cisco
This document contains licenses and notices for open source software used in this product. With respect to the free/open source software listed in...
Read more >WhatsNew 1.3 | Ktor Framework
"kotlin.IllegalStateException: Fail to send body. Content has type: class kotlinx.serialization.json.JsonObject, but OutgoingContent ...
Read more >Android – Page 3 - Handstand Sam
The last few days I have been struggling to get the Android Emulator to connect to ... //duplicate entry: org/objectweb/asm/AnnotationVisitor.class exclude ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It wasn’t because of transitive dependencies, it was a mispackaged dependency. Also remove okhttp-urlconnection dependency, it isn’t needed.
On Sun, Jan 17, 2016, 9:42 AM Marty Glaubitz notifications@github.com wrote:
It happened to me, and I just to make sure all the version of the same dependency in the whole project is the same. If you use jar, please delete it and add it in the dependency in the build.gradle file. for me, it worked fine. and I get the release apk. I think the reason why this happened is because the project has duplicated file. To solve this we need to make sure the dependency is unique.