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.

mutlidex: duplicate class okhttp3/Address.class even when all other inclusions of okhttp have been excluded

See original GitHub issue

I’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:closed
  • Created 8 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
JakeWhartoncommented, Jan 17, 2016

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:

alright, i’ll give it a run tomorow. Still, where could the duplicate Address.class come from? I mean, i’ve essentially excluded the entire package from the transient dependencies…

— Reply to this email directly or view it on GitHub https://github.com/JakeWharton/picasso2-okhttp3-downloader/issues/1#issuecomment-172330164 .

0reactions
boatImpishcommented, Nov 20, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

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