thudugala / Plugin.LocalNotification

The local notification plugin provides a way to show local notifications from .Net MAUI and Xamarin Forms apps .
MIT License
425 stars 68 forks source link

Type androidx.collection.ArrayMapKt is defined multiple times #517

Closed Calichi closed 1 month ago

Calichi commented 2 months ago

When debugging on a physical Android device from VSCode, I get the following exception.

Exception:

Type androidx.collection.ArrayMapKt is defined multiple times

Steps to reproduce the behavior:

1. Install the package plugin.LocalNotification_v11.1.4.

  1. Start debugging the project

Additional information

I am debugging a MAUI app intended for Android on a physical mobile device with OS (Android 10).

Version 10.1.8 of the mentioned package plugin.LocalNotification does not produce this issue and integrates correctly.

Spartananator commented 2 months ago

I am also having this issue when trying to build / debug a project to a android 14.0 API 34 android emulator build. I am running plugin v 11.1.4

darshanio commented 1 month ago

https://github.com/xamarin/AndroidX/issues/764

darshanio commented 1 month ago

Downgrading to 11.1.3 fixed the compilation issues.

Kaayo commented 1 month ago

Hello, I had the same problem here, I'm using .NET 8 and Maui Blazor, I managed to solve it by manually installing these packages in their latest versions:

 Xamarin.AndroidX.Collection = 1.4.3.1
 Xamarin.AndroidX.Collection.Jvm = 1.4.3.1
 Xamarin.AndroidX.Collection.Ktx = 1.4.3.1
 Xamarin.AndroidX.Preference = 1.2.1.10
RobertHassfeld commented 1 month ago

@Calichi Hi, I had the same issue as you.

But I need the 11.1.4 because of this issue: https://github.com/thudugala/Plugin.LocalNotification/issues/465

My solution works when I installed this Nugets.

<PackageReference Include="Xamarin.AndroidX.Collection" Version="1.4.0.5"/>
<PackageReference Include="Xamarin.AndroidX.Collection.Jvm" Version="1.4.0.5"/>
<PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.4.0.5"/>
<PackageReference Include="Xamarin.AndroidX.Fragment.Ktx" Version="1.7.0.2" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core" Version="2.7.0.4" />
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.9.0.3" />
RobDaytona commented 1 month ago

THIS NUGET FAILS RIGHT OUT THE BOX ON A FRESH INSTALL. STEPS TO REPRODUCE 1 - Create Brand New Maui App, (do not select the version with multiple projects per platform). 2 - Install [Plugin.LocalNotification] nuget 3 - Build: Build Fails: MSBUILD : java.exe error JAVA0000: Error in /androidx.collection.collection-jvm.jar:androidx/collection/ArraySetKt.class: MSBUILD : java.exe error JAVA0000: Type androidx.collection.ArraySetKt is defined multiple times:

/xamarin.androidx.collection.jvm\1.4.0.4\buildTransitive\net8.0-android34.0\..\..\jar\androidx.collection.collection-jvm.jar, /xamarin.androidx.collection.ktx\1.2.0.9\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection-ktx.jar MSBUILD : java.exe error JAVA0000: Compilation failed
Elvin-Thudugala-2degrees commented 1 month ago

Please follow instructions in https://github.com/thudugala/Plugin.LocalNotification/releases/tag/v11.1.4

Make sure to Add these Package Reference for android

<ItemGroup Condition="$(TargetFramework.Contains('-android'))">
  <PackageReference Include="Xamarin.AndroidX.Fragment.Ktx" Version="1.8.1" />
  <PackageReference Include="Xamarin.AndroidX.Lifecycle.Common" Version="2.8.3" />
  <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core" Version="2.8.3" />
  <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core.Ktx" Version="2.8.3" />
  <PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="2.8.3" />
  <PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime" Version="2.8.3" />
  <PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Ktx" Version="2.8.3" />
  <PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModel" Version="2.8.3" />
  <PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModel.Ktx" Version="2.8.3" />
  <PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModelSavedState" Version="2.8.3" />
</ItemGroup>