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

Detected package version outside of dependency constraint when using Xamarin.AndroidX.Car.App.App 1.4.0.4 #1044

Closed
mikelor opened this issue Nov 13, 2024 · 8 comments

Comments

@mikelor
Copy link

mikelor commented Nov 13, 2024

Android framework version

net9.0-android

Affected platform version

9.0.100

Description

I'm upgrading my Android Auto sample application Chaaos from .NET8 to .NET9. I'm including the latest Xamarin.AndroidX.Car.App.App (1.4.0.4) package. When building I get the following Warnings.

The main branch has the .NET8 version, and the dotnet9 branch contains the updated version. Also see a simple MAUI app in the following section that illustrates this issue.

1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: 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.
1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.LiveData.Core.Ktx 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.
1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Collection.Ktx 1.4.3.1 requires Xamarin.AndroidX.Collection.Jvm (>= 1.4.3.1 && < 1.4.4) but version Xamarin.AndroidX.Collection.Jvm 1.4.5.1 was resolved.
1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Runtime.Ktx 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.
1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.ViewModel.Ktx 2.8.5.1 requires Xamarin.AndroidX.Lifecycle.ViewModel (>= 2.8.5.1 && < 2.8.6) but version Xamarin.AndroidX.Lifecycle.ViewModel 2.8.7.1 was resolved.
1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Activity.Ktx 1.9.2.1 requires Xamarin.AndroidX.Activity (>= 1.9.2.1 && < 1.9.3) but version Xamarin.AndroidX.Activity 1.9.3.1 was resolved.
1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Runtime.Ktx.Android 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.
1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: 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.
1>Done building project "Chaaos.csproj".

Steps to Reproduce

I have created a repro basic MAUI App. See AndroidX-Repro. There is a Maui8 project and a Maui9 project. You can see that the MAUI8 project does not generate the Warnings, where the Maui9 project does.

Also Note that the Maui8 version has a fix for #18665

Did you find any workaround?

Not at the moment.

Relevant log output

1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: 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.
1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.LiveData.Core.Ktx 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.
1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Collection.Ktx 1.4.3.1 requires Xamarin.AndroidX.Collection.Jvm (>= 1.4.3.1 && < 1.4.4) but version Xamarin.AndroidX.Collection.Jvm 1.4.5.1 was resolved.
1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Runtime.Ktx 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.
1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.ViewModel.Ktx 2.8.5.1 requires Xamarin.AndroidX.Lifecycle.ViewModel (>= 2.8.5.1 && < 2.8.6) but version Xamarin.AndroidX.Lifecycle.ViewModel 2.8.7.1 was resolved.
1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Activity.Ktx 1.9.2.1 requires Xamarin.AndroidX.Activity (>= 1.9.2.1 && < 1.9.3) but version Xamarin.AndroidX.Activity 1.9.3.1 was resolved.
1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Runtime.Ktx.Android 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.
1>F:\source\Chaaos\src\Chaaos\Chaaos.csproj : warning NU1608: 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.
1>Done building project "Chaaos.csproj".
@dellis1972
Copy link

@moljac any ideas on this one?

@jpobst jpobst transferred this issue from dotnet/android Nov 13, 2024
@mikelor
Copy link
Author

mikelor commented Nov 13, 2024

I'd be happy to troubleshoot this, but unfortunately don't know too much about this aspect of Android.

Is there anything I can do to narrow the problem further? Or do I just regen all the libraries. Where to start?

@moljac
Copy link
Contributor

moljac commented Nov 14, 2024

@moljac any ideas on this one?

Usually explicit ProjectReferences to latest package[s] help. but the problem is to find which packages. Mileage counts. I will take a look later.

@moljac
Copy link
Contributor

moljac commented Nov 14, 2024

I added PR to the sample

mikelor/AndroidX-Repro#1

Sample:

Archive.zip

Basically solution is to add latest packages (not all):

	<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-android'">
		<!--
		new package created after MAUI release
		-->
		<PackageReference Include="Xamarin.AndroidX.Car.App.App" Version="1.4.0.4" />
		<!--
		explicit references to override MAUI used versions
		-->
		<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.8.7.1" />
		<PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime" Version="2.8.7.1" />
		<PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Ktx" Version="2.8.7.1" />
		<PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="2.8.7.1" />
		<PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModel.Ktx" Version="2.8.7.1" />
		<PackageReference Include="Xamarin.AndroidX.Collection.Jvm" Version="1.4.5.1" />
		<PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.4.5.1" />
		<PackageReference Include="Xamarin.AndroidX.Activity" Version="1.9.3.1" />
		<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.9.3.1" />		 
	</ItemGroup>

@mikelor
Copy link
Author

mikelor commented Nov 14, 2024

Ok, so I analyzed the Maui9 project in this repo and these are the "warnings"

Xamarin.AndroidX.Lifecycle.LiveData 2.8.5.1 requires
	Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.8.5.1 && < 2.8.6)
		Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.7.1 was resolved

Xamarin.AndroidX.Lifecycle.LiveData.Core.Ktx 2.8.5.1 requires
	Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.8.5.1 && < 2.8.6)
		Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.7.1 was resolved

Xamarin.AndroidX.Collection.Ktx 1.4.3.1 requires
	Xamarin.AndroidX.Collection.Jvm (>= 1.4.3.1 && < 1.4.4) 
		Xamarin.AndroidX.Collection.Jvm 1.4.5.1 was resolved.

Xamarin.AndroidX.Lifecycle.Runtime.Ktx 2.8.5.1 requires
	Xamarin.AndroidX.Lifecycle.Runtime (>= 2.8.5.1 && < 2.8.6)
		Xamarin.AndroidX.Lifecycle.Runtime 2.8.7.1 was resolved

Xamarin.AndroidX.Lifecycle.ViewModel.Ktx 2.8.5.1 requires
	Xamarin.AndroidX.Lifecycle.ViewModel (>= 2.8.5.1 && < 2.8.6)
		Xamarin.AndroidX.Lifecycle.ViewModel 2.8.7.1 was resolved.

Xamarin.AndroidX.Activity.Ktx 1.9.2.1 requires
	Xamarin.AndroidX.Activity (>= 1.9.2.1 && < 1.9.3)
		Xamarin.AndroidX.Activity 1.9.3.1 was resolved.

Xamarin.AndroidX.Lifecycle.Runtime.Ktx.Android 2.8.5.1 requires
	Xamarin.AndroidX.Lifecycle.Runtime (>= 2.8.5.1 && < 2.8.6)
		Xamarin.AndroidX.Lifecycle.Runtime 2.8.7.1 was resolved.

Xamarin.AndroidX.Lifecycle.Process 2.8.5.1
	Xamarin.AndroidX.Lifecycle.Runtime (>= 2.8.5.1 && < 2.8.6)
		Xamarin.AndroidX.Lifecycle.Runtime 2.8.7.1 was resolved

In the issue-1044 branch of the repo, I included the following references.

	<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-android'">
		<PackageReference Include="Xamarin.AndroidX.Car.App.App" Version="1.4.0.4" />
	
		<!-- Trying to Resolve https://github.com/dotnet/android-libraries/issues/1044 -->
		<PackageReference Include="Xamarin.AndroidX.Activity"			Version="1.9.2.1" />
		<PackageReference Include="Xamarin.AndroidX.Collection.Jvm"		Version="1.4.5.1" />

		<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core"	Version="2.8.5.1" />
		<PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime"		Version="2.8.5.1" />
		<PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModel"	Version="2.8.5.1" />
	</ItemGroup>

Unfortunately, I ended up with the following error and warning

1>F:\source\AndroidX.Car\Maui9\Maui9.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Collection.Ktx 1.4.3.1 requires Xamarin.AndroidX.Collection.Jvm (>= 1.4.3.1 && < 1.4.4) but version Xamarin.AndroidX.Collection.Jvm 1.4.5.1 was resolved.
1>F:\source\AndroidX.Car\Maui9\Maui9.csproj : error NU1107: Version conflict detected for Xamarin.AndroidX.Lifecycle.Common. Install/reference Xamarin.AndroidX.Lifecycle.Common 2.8.7.1 directly to project Maui9 to resolve this issue. 
1>F:\source\AndroidX.Car\Maui9\Maui9.csproj : error NU1107:  Maui9 -> Xamarin.AndroidX.Car.App.App 1.4.0.4 -> Xamarin.AndroidX.Lifecycle.Common.Java8 2.8.7.1 -> Xamarin.AndroidX.Lifecycle.Common (>= 2.8.7.1 && < 2.8.8) 
1>F:\source\AndroidX.Car\Maui9\Maui9.csproj : error NU1107:  Maui9 -> Xamarin.AndroidX.Lifecycle.Runtime 2.8.5.1 -> Xamarin.AndroidX.Lifecycle.Common (>= 2.8.5.1 && < 2.8.6).

In looking at the latest config.json in the repo, all of the 2.8.7.1 versions are specified. Is the problem I'm having due to the version of Android-Libraries that MAUI 9 / .NET9 uses? If so, how do I find out what version of "Xamarin.AndroicX.Car.App.App" to use?

@mikelor
Copy link
Author

mikelor commented Nov 14, 2024

Oops, I just saw your message. I'll try that. Thank You.

@mikelor
Copy link
Author

mikelor commented Nov 14, 2024

Hey @moljac your PR worked. Thank you for the quick fix. This should help me in the future if I run into this again
Closing!

@mikelor mikelor closed this as completed Nov 14, 2024
@moljac
Copy link
Contributor

moljac commented Nov 14, 2024

Hey @moljac your PR worked. Thank you for the quick fix. This should help me in the future if I run into this again
Closing!

Great that I could help. Remember: it might [will] happen again, but the workaround is to add explicit dependencies. We work on [re]solution, but it is not trivial.

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

5 participants