themronion / Maui.GoogleMaps

Map library for MAUI using Google maps API
https://www.nuget.org/packages/Onion.Maui.GoogleMaps/
MIT License
79 stars 35 forks source link

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

Closed plppp2001 closed 9 months ago

plppp2001 commented 9 months ago

VERSIONS

IDE

PLATFORMS

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>
themronion commented 9 months ago

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

plppp2001 commented 9 months ago

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

Ok great thank you.

RapsysInfoTech commented 7 months ago

Thanks to the team , it works

plppp2001 commented 7 months ago

Thanks to the team , it works

What did you do exactly? thanks let us know

eduardoagr commented 2 months ago

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

themronion commented 2 months ago

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

eduardoagr commented 2 months ago

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

`

<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" />

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
eduardoagr commented 2 months ago

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