Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating to .net 9 android causing version outside of dependency constraint #1050

Open
gabsamples6 opened this issue Nov 17, 2024 · 6 comments

Comments

@gabsamples6
Copy link

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 NU1608 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

@moljac
Copy link
Contributor

moljac commented Nov 19, 2024

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

@gabsamples6
Copy link
Author

gabsamples6 commented Nov 19, 2024

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?

@moljac
Copy link
Contributor

moljac commented Nov 19, 2024

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.

@gabsamples6
Copy link
Author

gabsamples6 commented Nov 19, 2024

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

AppMaui.Issue1050.zip

@gmck
Copy link

gmck commented Nov 25, 2024

@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.

@moljac
Copy link
Contributor

moljac commented Nov 25, 2024

@gabsamples6 I will take a look tomorrow.

@gmck Yes it is usully about updating to latest packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants