19

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

2 Answers 2

43

Try adding these nuget packages as Android dependencies:

Xamarin.AndroidX.Collection

Xamarin.AndroidX.Collection.Ktx

Sign up to request clarification or add additional context in comments.

7 Comments

Thanks for this! You saved me a whole bunch of time.
@wallef 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.
How about this error? Type androidx.lifecycle.DispatchQueue is defined multiple times
I had to also add Xamarin.AndroidX.Activity and Xamarin.AndroidX.Activity.Ktx
I thought MAUI used the jvm and MS recommended it over Kotlin. This is so confusing
|
0

For me adding the NuGet Package "Xamarin.AndroidX.Fragment.Ktx" solved the issue

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.