在 .NET MAUI 库中添加 `Xamarin.AndroidX.Biometric` 会引发异常

问题描述 投票:0回答:1

当我将 Xamarin.AndroidX.Biometric 添加到 Maui 类库,然后尝试在我的项目中使用此库时,它开始抛出以下错误。关于可能导致此问题的任何线索吗?

您可以查看此 Github 作为复制存储库。

目前我已经提出了 MAUI 的问题,但我不确定这是否真的是 MAUI 的错误,还是我遗漏了一些东西 https://github.com/dotnet/maui/issues/20315

/Users/gulamalihakim/Documents/Personal/Plugin.Maui.Biometric/Plugin.Maui.Biometric/Samples: Error JAVA0000: Error in /Users/gulamalihakim/.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: /Users/gulamalihakim/.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, /Users/gulamalihakim/.nuget/packages/xamarin.androidx.collection.ktx/1.2.0.9/buildTransitive/net6.0-android31.0/../../jar/androidx.collection.collection-ktx.jar:androidx/collection/ArraySetKt.class
Compilation failed
java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: /Users/gulamalihakim/.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
    at com.android.tools.r8.utils.R0.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:126)
    at com.android.tools.r8.D8.main(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:5)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: /Users/gulamalihakim/.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
    at Version.fakeStackEntry(Version_8.1.56.java:0)
    at com.android.tools.r8.M.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:5)
    at com.android.tools.r8.utils.R0.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:81)
    at com.android.tools.r8.utils.R0.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:32)
    at com.android.tools.r8.utils.R0.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:31)
    at com.android.tools.r8.utils.R0.b(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:2)
    at com.android.tools.r8.D8.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:26)
    at com.android.tools.r8.D8.b(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:13)
    at com.android.tools.r8.D8.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:24)
    at com.android.tools.r8.utils.R0.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:113)
    ... 1 more
Caused by: com.android.tools.r8.utils.b: Type androidx.collection.ArraySetKt is defined multiple times: /Users/gulamalihakim/.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, /Users/gulamalihakim/.nuget/packages/xamarin.androidx.collection.ktx/1.2.0.9/buildTransitive/net6.0-android31.0/../../jar/androidx.collection.collection-ktx.jar:androidx/collection/ArraySetKt.class
    at com.android.tools.r8.utils.O2.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:21)
    at com.android.tools.r8.utils.O2.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:26)
    at com.android.tools.r8.utils.A2.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:44)
    at com.android.tools.r8.utils.A2.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:10)
    at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
    at com.android.tools.r8.utils.A2.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:6)
    at com.android.tools.r8.graph.b4$a.e(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:7)
    at com.android.tools.r8.dex.c.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:58)
    at com.android.tools.r8.dex.c.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:9)
    at com.android.tools.r8.dex.c.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:8)
    at com.android.tools.r8.D8.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:29)
    at com.android.tools.r8.D8.d(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:17)
    at com.android.tools.r8.D8.c(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:1)
    at com.android.tools.r8.utils.R0.a(R8_8.1.56_756d1f50f618dd1c39c000f11defb367a21e9e866e3401b884be16c0950f6f79:28)
    ... 6 more
 (JAVA0000) (Samples) java
xamarin xamarin.android maui
1个回答
0
投票

因此,在花了一些时间解决该错误后,我意识到问题在于生物识别 Nuget 需要最新版本的

Xamarin.Androidx.Collection.Ktx
将其添加到我的项目中解决了该问题,我认为此引用应该在内部绑定到 NuGet 本身。

https://www.nuget.org/packages/Xamarin.AndroidX.Collection.Ktx

© www.soinside.com 2019 - 2024. All rights reserved.