-
Notifications
You must be signed in to change notification settings - Fork 63
Closed
Description
Android framework version
net9.0-android
Affected platform version
.NET 9.0.101
Description
I am trying to compile a Xamarin.android project which was recently converted to .NET MAUI using the upgrade-assistant and making all the necessary changes in files and .csproj.
I suddenly started having issues with the dependencies so I decided to upgrade all of them to the latest versions. I resolved all the issues associated to this #764 but I can't fix this one.
It seems to me that MAUI crucially depends on xamarin.android.jetbrains.kotlinx_serialization_core_jvm version 1.3.1. However, some packages in my project also depend on Xamarin.KotlinX.Serialization.Core.Jvm version 1.7.3.1. The class in question is defined in both.
How do I resolve this? I can't remove either without errors.
Relevant log output
`
0>: Error JAVA0000 java: Error in /Users/[user]/.nuget/packages/xamarin.android.jetbrains.kotlinx_serialization_core_jvm/1.3.1/buildTransitive/../jar/org.jetbrains.kotlinx.kotlinx-serialization-core-jvm.jar:kotlinx/serialization/BinaryFormat.class:
Type kotlinx.serialization.BinaryFormat is defined multiple times: /Users/[user]/.nuget/packages/xamarin.android.jetbrains.kotlinx_serialization_core_jvm/1.3.1/buildTransitive/../jar/org.jetbrains.kotlinx.kotlinx-serialization-core-jvm.jar:kotlinx/serialization/BinaryFormat.class, obj/Debug/net9.0-android/lp/679/jl/libs/623E6E29E2058512.jar:kotlinx/serialization/BinaryFormat.class
Compilation failed
java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: /Users/[user]/.nuget/packages/xamarin.android.jetbrains.kotlinx_serialization_core_jvm/1.3.1/buildTransitive/../jar/org.jetbrains.kotlinx.kotlinx-serialization-core-jvm.jar
kotlinx/serialization/BinaryFormat.class
at com.android.tools.r8.internal.to.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:131)
at com.android.tools.r8.D8.main(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:5)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: /Users/[user]/.nuget/packages/xamarin.android.jetbrains.kotlinx_serialization_core_jvm/1.3.1/buildTransitive/../jar/org.jetbrains.kotlinx.kotlinx-serialization-core-jvm.jar:kotlinx/serialization/BinaryFormat.class
at Version.fakeStackEntry(Version_8.5.35.java:0)
at com.android.tools.r8.T.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:5)
at com.android.tools.r8.internal.to.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:82)
at com.android.tools.r8.internal.to.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:32)
at com.android.tools.r8.internal.to.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:31)
at com.android.tools.r8.internal.to.b(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:2)
at com.android.tools.r8.D8.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:41)
at com.android.tools.r8.D8.b(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:13)
at com.android.tools.r8.D8.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:39)
at com.android.tools.r8.internal.to.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:118)
... 1 more
Caused by: com.android.tools.r8.internal.g: Type kotlinx.serialization.BinaryFormat is defined multiple times: /Users/[user]/.nuget/packages/xamarin.android.jetbrains.kotlinx_serialization_core_jvm/1.3.1/buildTransitive/../jar/org.jetbrains.kotlinx.kotlinx-serialization-core-jvm.jar:kotlinx/serialization/BinaryFormat.class, obj/Debug/net9.0-android/lp/679/jl/libs/623E6E29E2058512.jar:kotlinx/serialization/BinaryFormat.class
at com.android.tools.r8.internal.x50.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:21)
at com.android.tools.r8.internal.LY.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:54)
at com.android.tools.r8.internal.LY.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:10)
at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056)
at com.android.tools.r8.internal.LY.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:6)
at com.android.tools.r8.graph.p4$a.d(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:6)
at com.android.tools.r8.dex.c.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:95)
at com.android.tools.r8.dex.c.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:44)
at com.android.tools.r8.dex.c.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:9)
at com.android.tools.r8.D8.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:44)
at com.android.tools.r8.D8.d(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:17)
at com.android.tools.r8.D8.c(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:73)
at com.android.tools.r8.internal.to.a(R8_8.5.35_9c55004e7c41a17b1ed47c4e1952cb6778b3dac6afb6afc113a2737c3cde13e0:28)
... 6 more
Directory 'obj/Debug/net9.0-android/lp/679' is from 'Xamarin.KotlinX.Serialization.Core.Jvm.aar'.
Activity
moljac commentedon Jan 2, 2025
Thanks for the feedback.
Please see:
#764
Otherwise provide list of
PackageReferences so we can investigate.moljac commentedon Jan 2, 2025
OK I just saw
Yes it is very problem (app) specific - dependencies, transitive dependencies.
jethro-djan commentedon Jan 2, 2025
So I tracked it down to removing
Microsoft.Maui.Controls. Then I reverted some of the packages back to previous versions that don't depend onSerialization.Core. Then I could safely removeXamarin.KotlinX.Serialization.Core.Jvmversion1.7.3.1. Now I am unable to compile due to another error (which I don't think is related to this but would appreciate any pointers as to how to resolve).The particular library that is not correctly aligned keeps changing.
Or could it be that removing the package caused this?
moljac commentedon Jan 2, 2025
Error
is very different from
where T in your case is
kotlinx.serialization.BinaryFormat1st one is Warning for now:
https://learn.microsoft.com/en-us/dotnet/android/messages/xa0141
Android uses 4kB pages and in the future it will be 16 kB. This warning is for authors of nugets that have native shared (
*.so) libraries which will be need recompilation with 16 kB page size.Type XYZ is defined multiple times||packages generated by more than one managed type#764jpobst commentedon Jan 17, 2025
It should also be noted that https://www.nuget.org/packages/Xamarin.Android.JetBrains.KotlinX_Serialization_Core_Jvm is not a Microsoft package and I highly doubt MAUI itself depends on it. 😉
moljac commentedon Jan 17, 2025
@jethro-djan
And
https://www.nuget.org/packages/Xamarin.Android.JetBrains.KotlinX_Serialization_Core_Jvm#versions-body-tab
is simply too old 2021-12-30. More than 4 years.
closing this issue.