Updating to .net 9 android causing version outside of dependency constraint
Android framework version
net9.0-android
Affected platform version
VS2022 17.12
Description
We are trying to update to .net 9 and our push notification project is holding us back!
Can someone explain to me what Am Im missing ,
- I have a push notification project using Azure notification hub and i have .net 8 compiling
- but .net 9 doesnt ,
- I can resolve with a <NoWarn>NU1608</NoWarn> but seems wrong and not sure what I will break.
Can someone advise?
Warning As Error: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Process 2.8.5.1 requires Xamarin.AndroidX.Lifecycle.Runtime (>= 2.8.5.1 && < 2.8.6) but version Xamarin.AndroidX.Lifecycle.Runtime 2.8.7.1 was resolved.
Warning As Error: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.LiveData 2.8.5.1 requires Xamarin.AndroidX.Lifecycle.LiveData.Core.Ktx (>= 2.8.5.1 && < 2.8.6) but version Xamarin.AndroidX.Lifecycle.LiveData.Core.Ktx 2.8.7.1 was resolved.
Warning As Error: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.LiveData 2.8.5.1 requires Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.8.5.1 && < 2.8.6) but version Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.7.1 was resolved.
.net 8 below works
<ItemGroup>
<PackageReference Include="Microsoft.Azure.NotificationHubs" Version="4.2.0" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.91" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.91" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
<PackageReference Include="Xamarin.AndroidX.Fragment.Ktx">
<Version>1.8.2.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Messaging">
<Version>124.0.0.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.Dagger">
<Version>2.52.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Base">
<Version>118.5.0.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Basement">
<Version>118.4.0.1</Version>
</PackageReference>
</ItemGroup>
**Below using .net 9 I get all sorts of issues of android incompatabilities **
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-android'">
<PackageReference Include="Xamarin.Firebase.Messaging">
<Version>124.0.3.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Base">
<Version>118.5.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Basement">
<Version>118.4.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Fragment.Ktx">
<Version>1.8.5.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.Dagger">
<Version>2.52.0</Version>
</PackageReference>
</ItemGroup>
### Steps to Reproduce
See above dependencies
### Did you find any workaround?
Add a nowarn but not sure is the right thing todo
### Relevant log output
```shell
Thanks for the feedback.
This happens in the real world projects where some packages might introduce version mismatch via transitive dependencies.
Easiest workaround:
Turn off Warning As Error for NU1608
I will try to make repro sample, but it will take some time
what about If I make the repo with issue , would it speed it up? also if I had the "<nowarn><NU1608> I have to add it somewhere else.. are they any possible interface breaking that could cause the app to crash?
what about If I make the repo with issue , would it speed it up? also if I had the "
<nowarn><NU1608> I have to add it somewhere else.. are they any possible interface breaking that could cause the app to crash?
This is usually what we beg for.
dotnet new maui -o AppMAUI.IssueXXX
or for you
dotnet new android -o AppMAUI.IssueXXX
and then add JUST <PackageReference>s. This should suffice for this problem.
Hi I have uploaded a project and has 2 proj, what really matters is the MauiClassLibrary.Issue1050 where I cant get the package references to work.
thanks
@gabsamples6 I had the same problem with those warnings, although they did not affect the app building or running. The warnings went away when I upgraded Xamarin.Android.Navigation.Fragment and Xamarin.Android.NavigationUI to 2.8.4. All the Xamarin.AndroidX.Lifecycle dependencies are now 2.8.7.1.
@gabsamples6 I will take a look tomorrow.
@gmck Yes it is usully about updating to latest packages.
I'm having the same problem.
From what I can see it is just a warning but would be good to get it fixed because it's generating a lot of warnings throughout all our solutions.
Hi @jpobst may I know if you anyone from dotnet android team can get this compile wanring fix please?