Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java linking conflict when adding Xamarin.AndroidX.Biometric in .NET MAUI 8.0 Android project #26963

Closed
skolesni opened this issue Jan 5, 2025 · 4 comments
Labels
platform/android 🤖 s/triaged Issue has been reviewed t/bug Something isn't working

Comments

@skolesni
Copy link

skolesni commented Jan 5, 2025

Description

When including the Xamarin.AndroidX.Biometric NuGet package, a Java linking conflict occurs, causing the build to fail with a “type is defined multiple times” error for androidx.collection.ArrayMapKt. This library appears to pull conflicting references from both Xamarin.AndroidX.Collection.Jvm and Xamarin.AndroidX.Collection.Ktx in a .NET 8.0 Android environment.

Steps to Reproduce

  1. Create a new .NET MAUI 8.0 Android project.
  2. Add the Xamarin.AndroidX.Biometric NuGet package ().
  3. Attempt to build the Android project.
  4. Observe that the build fails with the Java linking conflict error.

Link to public reproduction project repository

https://github.com/skolesni/Sample.XamarinAndroidXBiometric.Issue

Version with bug

8.0.100 SR10

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

.NET MAUI 8.0 for Android (targeting Android 34)

Did you find any workaround?

Community references suggest adding Xamarin.AndroidX.Collection, Xamarin.AndroidX.Collection.Ktx, and later versions of Xamarin.AndroidX.Biometric, but these steps have not resolved the error in the affected project.

Relevant log output

Type androidx.collection.ArrayMapKt is defined multiple times:
.../xamarin.androidx.collection.jvm/...ArrayMapKt.class,
.../xamarin.androidx.collection.ktx/...ArrayMapKt.class

Error JAVA0000: Error in ...androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class:
Type androidx.collection.ArrayMapKt is defined multiple times
...

java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException
Caused by: com.android.tools.r8.utils.b: Type androidx.collection.ArrayMapKt is defined multiple times
...

See https://github.com/skolesni/Sample.XamarinAndroidXBiometric.Issue/blob/main/README.md for more information.
@skolesni skolesni added the t/bug Something isn't working label Jan 5, 2025
@ninachen03 ninachen03 added platform/android 🤖 s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version labels Jan 6, 2025
@ninachen03
Copy link

This issue has been verified using Visual Studio 17.13.0 Preview 2.1 (9.0.21). Cannot repro on android platform. but it can reproduce on 17.13.0 Preview 2.1(8.0.100 & 8.0.3)
Image

@jfversluis
Copy link
Member

Just tried it as well: using VS Code, with .NET 9 it all works as intended so I'm not going to spend too much time here trying to figure out why it doesn't work on .NET 8.

Please keep in mind that .NET MAUI does not have LTS releases so there should be no reason not to update to .NET 9.

@jfversluis jfversluis closed this as not planned Won't fix, can't repro, duplicate, stale Jan 6, 2025
@skolesni
Copy link
Author

skolesni commented Jan 6, 2025

Dear @ninachen03 and @jfversluis, thank you for your effort verifying the issue, and finding a resolution. We will retest at our end and will confirm.

@dotnet-policy-service dotnet-policy-service bot removed the s/try-latest-version Please try to reproduce the potential issue on the latest public version label Jan 6, 2025
@jfversluis
Copy link
Member

Additionally, some helpful information might be found here: dotnet/android-libraries#764

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform/android 🤖 s/triaged Issue has been reviewed t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants