Search code examples
xamarinxamarin.androidgoogle-play-servicesmapbox-android

"java.lang.illegalargumentexception: already added lokhttp3/address" when installing Xamarin.GooglePlayServices.*


I'm building a Xamarin.Android application, but I'm having troubles every time I add any Xamarin.GooglePlayServices.* NuGet packages. First time my .csproj was corrupted, and I had to start the project all over and include all files in a new project. I avoided those libs, but now I need them. This time, I get this error

java.lang.illegalargumentexception: already added lokhttp3/address

I've searched for days, but have not been able to find an answer. Anyone who knows how to resolve the java.lang.illegalargumentexception: already added error in Xamarin.Android?

EDIT:

I've found that I can reproduce this error by create a blank Xamarin.Android project and import package XBindings.MapboxLocationLayer.Droid as the only package.


Solution

  • I am the main author of these libraries and the founder of NAXAM, the company behind a lot of binding libraries: MAPBOX, BRAINTREE, STRIPE.

    I have supported to resolve the issue.

    Regarding this issue, plz uninstall NAXAM/Xbindings packages then re-install only direct reference packages. It's the issue of history, very sorry for this inconvenient.

    • Some may be interested in Mapbox Navigation library as well, plz read our readme carefully because there are Android Support packages un-published by XAMARIN yet

    In the mean time, packages for Android.Arch.Core.Runtime and Android.Arch.Lifetime.Extensions aren't published by Xamarin yet. Plz add a nuget source to https://www.myget.org/F/xbindings/api/v3/index.json either directly in Visual Studio Nuget Packages Source or via nuget.config file.

    • Some packages' versions are ending with beta and VS doesn't understand them as dependencies, plz add them manually. They are beta because at the time of their creation, native libraries are beta.

    Cheers.

    Tuyen, Founder of NAXAM - https://naxam.net