xamarin / GooglePlayServicesComponents

Other
315 stars 146 forks source link

Xamarin.GooglePlayServices.Ads.Lite: Version conflict #840

Open tipa opened 9 months ago

tipa commented 9 months ago

Xamarin.Android Version (eg: 6.0):

.NET8

Describe your Issue

After the latest round of updates, there is a package incompatibility between Xamarin.GooglePlayServices.Ads.Lite & Xamarin.AndroidX.Preference

Packages used:

<PackageReference Include="Xamarin.AndroidX.Preference" Version="1.2.1.4" />
<PackageReference Include="Xamarin.GooglePlayServices.Ads.Lite" Version="122.3.0.2" />

Steps to Reproduce (with link to sample solution if possible):

dotnet new android
dotnet add package Xamarin.AndroidX.Preference
dotnet add package Xamarin.GooglePlayServices.Ads.Lite

Include any relevant Exception Stack traces, build logs, adb logs:

error: NU1107: Version conflict detected for Xamarin.AndroidX.Lifecycle.LiveData.Core. Install/reference Xamarin.AndroidX.Lifecycle.LiveData.Core 2.7.0.1 directly to project ads_dependency to resolve this issue.
error:  ads_dependency -> Xamarin.AndroidX.Preference 1.2.1.4 -> Xamarin.AndroidX.SlidingPaneLayout 1.2.0.11 -> Xamarin.AndroidX.Transition 1.4.1.16 -> Xamarin.AndroidX.Fragment 1.6.2.2 -> Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.7.0.1)
error:  ads_dependency -> Xamarin.GooglePlayServices.Ads.Lite 122.3.0.2 -> Xamarin.AndroidX.Work.Runtime 2.9.0 -> Xamarin.AndroidX.Lifecycle.LiveData 2.6.2.3 -> Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.6.2.3 && < 2.6.3).
info : Package 'Xamarin.GooglePlayServices.Ads.Lite' is compatible with all the specified frameworks in project 'C:\Users\user\Desktop\ads_dependency\ads_dependency.csproj'.
info : PackageReference for package 'Xamarin.GooglePlayServices.Ads.Lite' version '122.3.0.2' added to file 'C:\Users\user\Desktop\ads_dependency\ads_dependency.csproj'.
info : Generating MSBuild file C:\Users\user\Desktop\ads_dependency\obj\ads_dependency.csproj.nuget.g.props.
info : Generating MSBuild file C:\Users\user\Desktop\ads_dependency\obj\ads_dependency.csproj.nuget.g.targets.
info : Writing assets file to disk. Path: C:\Users\user\Desktop\ads_dependency\obj\project.assets.json
log  : Failed to restore C:\Users\user\Desktop\ads_dependency\ads_dependency.csproj (in 177 ms).
moljac commented 8 months ago

@tipa Thanks for the feedback.

Expected. "Alignment bumps" ready, but we were blocked with nuget file sizes.

jpobst commented 2 months ago

https://github.com/xamarin/AndroidX/issues/764

tipa commented 1 month ago

Still problems with the latest round of updates:

image

jpobst commented 1 month ago

Interesting, using your repro steps:

dotnet new android
dotnet add package Xamarin.AndroidX.Preference
dotnet add package Xamarin.GooglePlayServices.Ads.Lite

I get a lot of NU1608 warnings, but it still successfully compiles:

conflict_test.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.6 was resolved.
conflict_test.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.6 was resolved.
conflict_test.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.6 was resolved.
conflict_test.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Service 2.8.5.1 requires Xamarin.AndroidX.Lifecycle.Runtime (>= 2.8.5.1 && < 2.8.6) but version Xamarin.AndroidX.Lifecycle.Runtime 2.8.6 was resolved.
conflict_test.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.ViewModelSavedState 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.6 was resolved.
conflict_test.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.6 was resolved.
conflict_test.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.6 was resolved.
jpobst commented 1 month ago

It looks like this is caused by releasing just some new packages that had updates instead of releasing the entire set of packages we maintain at once.

That is, we released a new version of Xamarin.GooglePlayServices.Ads.Lite this morning (123.3.0) but we did not release a new version of Xamarin.AndroidX.Preference since it did not have any updates.

With this morning's updates we get the warnings I mentioned above, but if we use the packages from the full alignment bump released 10 days ago, there are no warnings:

<PackageReference Include="Xamarin.AndroidX.Preference" Version="1.2.1.10" />
<PackageReference Include="Xamarin.GooglePlayServices.Ads.Lite" Version="123.1.0.1" />

I think the dependency graph is now so complex and intertwined that we can no longer release individual packages. We are going to have to move to a model where our releases always contain the entire ecosystem of packages to keep the dependency graph clean. We probably wouldn't do this weekly, perhaps we do a full release at a ~set time monthly like "first Tuesday" or something?

tipa commented 1 month ago

These are the packages I use in all my apps:

    <PackageReference Include="Xamarin.Android.Google.BillingClient" Version="7.1.0" />
    <PackageReference Include="Xamarin.AndroidX.Preference" Version="1.2.1.10" />
    <PackageReference Include="Xamarin.Firebase.Analytics" Version="122.1.0" />
    <PackageReference Include="Xamarin.Firebase.Crashlytics" Version="119.1.0" />
    <PackageReference Include="Xamarin.Google.Android.Material" Version="1.11.0.3" />
    <PackageReference Include="Xamarin.Google.Android.Play.Review" Version="2.0.1.11" />

Building works on command line with dotnet build, but those warnings are treated as errors when building in Visual Studio - also updating individual packages fails when doing so in the NuGet UI in Visual Studio.

I think the dependency graph is now so complex and intertwined that we can no longer release individual packages. We are going to have to move to a model where our releases always contain the entire ecosystem of packages to keep the dependency graph clean. We probably wouldn't do this weekly, perhaps we do a full release at a ~set time monthly like "first Tuesday" or something?

I agree (but I would appreciate weekly updates ;))