First, I'm a complete noob on this. But I have a working MAUI project that builds. But when trying to start using Firebase I run into a problem that I've spent 10 hours googling and chaptGPTing. The proplem is that when I install the nuget Xamarin.Firebase.Auth I get the following error when building.
Rebuild started at 21:42...
Restored C:\Users\denni\source\repos\ShadowWood\ShadowWood\ShadowWood.csproj (in 713 ms).
1>------ Rebuild All started: Project: ShadowWood, Configuration: Debug Any CPU ------
1>C:\Users\denni\source\repos\ShadowWood\ShadowWood\Models\Realm.cs(6,19,6,28): warning CS8618: Non-nullable property 'FoodValue' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
1>C:\Users\denni\source\repos\ShadowWood\ShadowWood\Models\Realm.cs(6,19,6,28): warning CS8618: Non-nullable property 'FoodValue' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
1>ShadowWood -> C:\Users\denni\source\repos\ShadowWood\ShadowWood\bin\Debug\net8.0-windows10.0.19041.0\win10-x64\ShadowWood.dll
1>Done building project "ShadowWood.csproj".
1>C:\Users\denni\source\repos\ShadowWood\ShadowWood\Models\Realm.cs(6,19,6,28): warning CS8618: Non-nullable property 'FoodValue' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
1>ShadowWood -> C:\Users\denni\source\repos\ShadowWood\ShadowWood\bin\Debug\net8.0-android\ShadowWood.dll
1>MSBUILD : java.exe error JAVA0000: Error in C:\Users\denni\.nuget\packages\xamarin.androidx.collection.jvm\1.4.0.5\buildTransitive\net8.0-android34.0\..\..\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArraySetKt.class:
1>MSBUILD : java.exe error JAVA0000: Type androidx.collection.ArraySetKt is defined multiple times: C:\Users\denni\.nuget\packages\xamarin.androidx.collection.jvm\1.4.0.5\buildTransitive\net8.0-android34.0\..\..\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArraySetKt.class, C:\Users\denni\.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
1>MSBUILD : java.exe error JAVA0000: Compilation failed
1>MSBUILD : java.exe error JAVA0000: java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\denni\.nuget\packages\xamarin.androidx.collection.jvm\1.4.0.5\buildTransitive\net8.0-android34.0\..\..\jar\androidx.collection.collection-jvm.jar
1>MSBUILD : java.exe error JAVA0000: androidx/collection/ArraySetKt.class
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:135)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.D8.main(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
1>MSBUILD : java.exe error JAVA0000: Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\denni\.nuget\packages\xamarin.androidx.collection.jvm\1.4.0.5\buildTransitive\net8.0-android34.0\..\..\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArraySetKt.class
1>MSBUILD : java.exe error JAVA0000: at Version.fakeStackEntry(Version_8.2.33.java:0)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.T.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:82)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:32)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:31)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.S0.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:2)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:42)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.D8.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:13)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:40)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:122)
1>MSBUILD : java.exe error JAVA0000: ... 1 more
1>MSBUILD : java.exe error JAVA0000: Caused by: com.android.tools.r8.utils.b: Type androidx.collection.ArraySetKt is defined multiple times: C:\Users\denni\.nuget\packages\xamarin.androidx.collection.jvm\1.4.0.5\buildTransitive\net8.0-android34.0\..\..\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArraySetKt.class, C:\Users\denni\.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
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.Q2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:21)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:54)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:10)
1>MSBUILD : java.exe error JAVA0000: at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.graph.m4$a.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:61)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:12)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:9)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:45)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.D8.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:17)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.D8.c(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:69)
1>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:28)
1>MSBUILD : java.exe error JAVA0000: ... 6 more
1>MSBUILD : java.exe error JAVA0000:
1>Done building project "ShadowWood.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
========== Rebuild completed at 21:43 and took 01:21,711 minutes ==========
ChatGPT might have led me down the wrong path, but seems there is a problem with the transitive nugets Xamarin.AndroidX.Collection.Jvm and Xamarin.AndroidX.Collection.Ktx. I've tried installing them in their latest versions and added the code below to my .csproj. As I've seen suggestions in other threads on that. But I can't make this work...
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
<PackageReference Include="Xamarin.Firebase.Auth" Version="122.3.1.3">
<ExcludeAssets>build, runtime, compile</ExcludeAssets>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Collection.Jvm" Version="1.4.2" />
<PackageReference Include="Xamarin.AndroidX.Collection" Version="1.4.2" />
<PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.4.2" />
</ItemGroup>