A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
Hi @Kim Strasser ,
Thanks for reaching out.
This is happening because the AndroidX DataStore packages are not all being resolved to the same version. Some of them are still on 1.2.0.2, while others have already moved to 1.2.1. NuGet then tries to satisfy both sets of dependency rules, and that is what leads to the NU1608 warning.
Usually this warning does not mean the app is broken, but it is still worth cleaning up so restore/build remains consistent.
The cleanest fix is to keep the whole Xamarin.AndroidX.DataStore.* package family on the same version. In this case, I would recommend moving them to 1.2.1, since one of the dependency chains already requires 1.2.1.
Please check your project file or NuGet Package Manager and update any older DataStore packages, especially these if they are present:
Xamarin.AndroidX.DataStore.Android
Xamarin.AndroidX.DataStore.Core.Android
Xamarin.AndroidX.DataStore.Core.Jvm
Xamarin.AndroidX.DataStore.Core.OkIO.Jvm
Xamarin.AndroidX.DataStore.Preferences.Core.Android
Xamarin.AndroidX.DataStore.Preferences.Core.Jvm
Xamarin.AndroidX.DataStore.Preferences.Proto
They should all be using 1.2.1, or they should all be using the older 1.2.0.2 set. Mixing those two versions is what causes the warning.
If you manage the references directly in the project file, you can align the affected packages like this:
<ItemGroup Condition="$(TargetFramework.Contains('-android'))">
<PackageReference Include="Xamarin.AndroidX.DataStore.Android" Version="1.2.1" />
<PackageReference Include="Xamarin.AndroidX.DataStore.Core.Android" Version="1.2.1" />
<PackageReference Include="Xamarin.AndroidX.DataStore.Core.OkIO.Jvm" Version="1.2.1" />
<PackageReference Include="Xamarin.AndroidX.DataStore.Preferences.Core.Android" Version="1.2.1" />
<PackageReference Include="Xamarin.AndroidX.DataStore.Preferences.Core.Jvm" Version="1.2.1" />
<PackageReference Include="Xamarin.AndroidX.DataStore.Preferences.Proto" Version="1.2.1" />
</ItemGroup>
You may not need to add every package manually if some of them are only transitive dependencies. The important part is that there should not be any explicit 1.2.0.2 DataStore reference left while another DataStore package is resolving to 1.2.1.
After updating the package versions, restore the NuGet packages again. If the warning still appears, delete the bin and obj folders, then restore/build once more so the old dependency graph is cleared.
I would avoid suppressing NU1608 unless it is only needed as a short-term workaround. Aligning the package versions is the better fix here.
Hope this helps! If my answer was helpful, I would greatly appreciate it if you could follow the instructions here so others with the same problem can benefit as well.