Browsed by
Tag: MAUI

How to fix MAUI androidx.collection.ArrayMapKt is defined multiple times error

How to fix MAUI androidx.collection.ArrayMapKt is defined multiple times error

I recently came across a small issue with AndroidX not compiling in a Maui project after updating CommunityToolkit.Maui and Microsoft.Maui.Controls. The error message presented:

1>MSBUILD : java.exe error JAVA0000: Error in C:\Users\{User}.nuget\packages\xamarin.androidx.collection.jvm\1.4.0.4\buildTransitive\net8.0-android34.0….\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class:

Type androidx.collection.ArrayMapKt is defined multiple times

There’s a simple solution, install nuget package xamarin.androidx.fragment.ktx, which will provide bindings for AndroidX library.

After adding this package, this error resolved for me and compilation completed.