themronion/Maui.GoogleMaps

Type androidx.collection.ArrayMapKt is defined multiple times. .NET MAUI 8 - Onion.Maui.GoogleMaps 5.0.3

Closed this issue · 8 comments

VERSIONS

  • Maui.GoogleMaps - 5.0.3
  • .NET SDK - 8

IDE

  • Rider
  • Visual Studio
  • Visual Studio for Mac

PLATFORMS

  • Android
  • iOS

ACTUAL BEHAVIOR

// Write about of your problem
Type androidx.collection.ArrayMapKt is defined multiple time - within latest .net maui 8 and Onion.Maui.GoogleMaps 5.0.3


### EXPECTED BEHAVIOR 
Compile without error when updating to nuget v. 5.0.3
// Write about the behavior what you expected

HOW TO REPRODUCE

Fresh new .net MAUI 8 Project and Add Nuget Onion.Maui.GoogleMaps
// code and steps to reproduce

  1. New Maui 8 project
  2. Install latest Onion.Maui.GoogleMaps 5.0.3
  3. Build
  4. Error appears:
    "...... Error JAVA0000 packages\xamarin.androidx.collection.jvm\1.3.0.2\buildTransitive\net7.0-android33.0....\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class:
    Type androidx.collection.ArrayMapKt is defined multiple time .............................. etc"

NOTE How I got it to compile (but I'm not sure if this is the correct way this should be fixed, can someone please verify this is correct way to fix?)

I did get project to compile with the updated Onion.Maui.GoogleMaps 5.0.3 nuget within latest .NET maui 8:

  1. I added the following nugets to get it to compile:
    Screenshot 2024-02-06 152816

So I have this, not sure if this is the correct way to fix this (This does compile in new project)?

<ItemGroup>
	<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />
	<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.6" />
	<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
	<PackageReference Include="Onion.Maui.GoogleMaps" Version="5.0.3" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
  <PackageReference Include="Xamarin.AndroidX.Collection">
    <Version>1.3.0.2</Version>
  </PackageReference>
  <PackageReference Include="Xamarin.AndroidX.Collection.Ktx">
    <Version>1.3.0.2</Version>
  </PackageReference>
</ItemGroup>

Yes, the workaround is correct, it is a known issue in xamarin.android repo

Yes, the workaround is correct, it is a known issue in xamarin.android repo

Ok great thank you.

Thanks to the team , it works

Thanks to the team , it works

What did you do exactly? thanks let us know

I also want to fix this What did you do exactly? thanks let us know

@eduardoagr read the ticket description with more attention or check out sample app

I just do not understand, do I need to add this to the. csproj

`




1.3.0.2 1.3.0.2 `

I went through the demo and your work, and I Don see anything different

Although I haven't check the version you are using. I am using 5.1.2

So, I tried your package again @themronion, I downloaded your code, and it works perfectly.
I notice that wasn't the latest version, so I upgraded to 5.1.2 and immediately broke, I also tried to install the latest version of

Xamarin.AndroidX.Collection
Xamarin.AndroidX.Collection.Ktx

but nothing