Error JAVA0000 - Type androidx.collection.ArraySetKt is defined multiple times
Asked Answered
L

1

13

When trying to rebuild app I am migrating from Xamarin.android to MAUI, I am getting the following error.

It is not actually in the solution path, it is in the c drive under nuget\packages.

I dont know if this is important, but I noticed in the error, one path ends in: net7.0-android33.0 The other path ends in: net6.0-android31.0

Error JAVA0000 Error in C:\Users\asbissada.nuget\packages\xamarin.androidx.collection.jvm\1.3.0.2\buildTransitive\net7.0-android33.0....\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArraySetKt.class: Type androidx.collection.ArraySetKt is defined multiple times: C:\Users\asbissada.nuget\packages\xamarin.androidx.collection.jvm\1.3.0.2\buildTransitive\net7.0-android33.0....\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArraySetKt.class, C:\Users\asbissada.nuget\packages\xamarin.androidx.collection.ktx\1.2.0.10\buildTransitive\net6.0-android31.0....\jar\androidx.collection.collection-ktx.jar:androidx/collection/ArraySetKt.class Compilation failed

I see other JAVA0000 on SO but haven't seen this one. This is what the AndroidX packages look like (I don't see ArraySetKt in there). Although I do notice Xamarin.AndroidX.Lifecycle.Common has a warning symbol even though its on the latest version: enter image description here

Lanctot answered 6/2, 2024 at 15:51 Comment(0)
A
28

Try adding these nuget packages as Android dependencies:

Xamarin.AndroidX.Collection

Xamarin.AndroidX.Collection.Ktx

Aalto answered 6/2, 2024 at 16:9 Comment(6)
Thanks for this! You saved me a whole bunch of time.Saucer
Thank you, worked for me as well! Do you know why @Riccardo Minato or @ tonyedwardspzUniocular
@Uniocular Honestly, i didn't fully understand it. It has something to do with original Google libraries dependencies and their .NET bindings, which have to keep the same dependencies and if they're not completely up-to-date can cause some troubles.Aalto
How about this error? Type androidx.lifecycle.DispatchQueue is defined multiple timesUnravel
I had to also add Xamarin.AndroidX.Activity and Xamarin.AndroidX.Activity.KtxProverbial
I thought MAUI used the jvm and MS recommended it over Kotlin. This is so confusingCooperman

© 2022 - 2025 — McMap. All rights reserved.