Forum Xamarin Xamarin.Android

Square.Picasso NuGet causes duplicate okhttp/okio errors

KenYeeKenYee USMember ✭✭

Anyone know how to fix this? I can't find out where the duplicates are coming from...nothing in the logs that's obvious :-P
How about just "ignore all duplicate during dex"? :-)

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Tool exited with code: 1. Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/squareup/okhttp/Address;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
at com.android.dx.command.dexer.Main.processClass(Main.java:732)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:82)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:279)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lokio/AsyncTimeout$1;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
at com.android.dx.command.dexer.Main.processClass(Main.java:732)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:82)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:279)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)
2 errors; aborting
(StationCasinos.Android)

Posts

  • AlexanderOsokinAlexanderOsokin USMember ✭✭

    Same issue

  • CheesebaronCheesebaron DKInsider, University mod

    Is i this one you are using: https://www.nuget.org/packages/Square.Picasso/ ?

    Are you using other things that use OkHttp or OkIo?

  • KenYeeKenYee USMember ✭✭
    edited November 2015

    Forgot to update this...the reason for me was I was using Square.Picasso which sucked in Square.OkHttp which collided w/ the modernhttp NuGet package which also includes okhttp.
    There's no way to exclude subpackages in Xamarin like you can w/ gradle, so I just got rid of the modernhttp package.

  • CheesebaronCheesebaron DKInsider, University mod

    Newest version of ModernHttpClient uses the OkHttp nuget too. So there shouldn't be any problems there...

  • KenYeeKenYee USMember ✭✭

    unless it uses Square's okhttp, you'll get a conflict w/ ModernHttpClient. Get rid of it and the duplication should go away...really.

Sign In or Register to comment.