Xamarin.Forms icon indicating copy to clipboard operation
Xamarin.Forms copied to clipboard

[Bug] AndroidX dependencies cannot be updated

Open tranb3r opened this issue 3 years ago • 8 comments

XF SR10 (5.0.0.2401) depends on old versions of AndroidX. For example, it's stuck with Xamarin.AndroidX.Core < 1.7.0. Could you please update AndroidX dependencies?

tranb3r avatar Jun 07 '22 10:06 tranb3r

you can install the AndroidX packages manually to have better control on which package is used. Beside the NU1608 warning, our apps still work so far:

NU1608: Detected package version outside of dependency constraint: Xamarin.Essentials 1.7.3 requires Xamarin.AndroidX.Browser (>= 1.3.0.5 && < 1.4.0) but version Xamarin.AndroidX.Browser 1.4.0.2 was resolved.
NU1608: Detected package version outside of dependency constraint: Xamarin.Forms 5.0.0.2401 requires Xamarin.AndroidX.Lifecycle.LiveData (>= 2.3.1.1 && < 2.4.0) but version Xamarin.AndroidX.Lifecycle.LiveData 2.4.1.2 was resolved.
NU1608: Detected package version outside of dependency constraint: Xamarin.Forms 5.0.0.2401 requires Xamarin.Google.Android.Material (>= 1.4.0.2 && < 1.5.0) but version Xamarin.Google.Android.Material 1.6.1.1 was resolved.
NU1608: Detected package version outside of dependency constraint: Xamarin.Forms 5.0.0.2401 requires Xamarin.AndroidX.Browser (>= 1.3.0.6 && < 1.4.0) but version Xamarin.AndroidX.Browser 1.4.0.2 was resolved.
NU1608: Detected package version outside of dependency constraint: Xamarin.Forms 5.0.0.2401 requires Xamarin.AndroidX.Core (>= 1.6.0.1 && < 1.7.0) but version Xamarin.AndroidX.Core 1.8.0.1 was resolved.

MagicAndre1981 avatar Jun 09 '22 08:06 MagicAndre1981

The latest Xamarin.Forms version had a minor bump. We're pinning these versions on purpose because in the past we have been surprised by breaking changes on the Android side.

What version would you like to see added?

jfversluis avatar Jun 15 '22 09:06 jfversluis

Thanks for answering Gerald :)

I've had a lot of conflicts in the past, especially with Xamarin.Firebase.* requiring higher versions than Xamarin.Forms.

I think right now it's kind of ok:

  • Xamarin.Forms 5.0.0.2478 -> Xamarin.AndroidX.Core <= 1.7.0.2
  • Xamarin.Firebase.Messaging 122.0.0.6 -> Xamarin.AndroidX.Core >= 1.7.0.2

I know it's impossible to reference the latest AndroidX versions in all packages. But I think it would be better to make it as much as possible consistent between Xamarin packages.

tranb3r avatar Jun 15 '22 09:06 tranb3r

I have a (possibly bad) habit of updating packages to the latest versions before I have the chance to see if any of the issues in there effect me.

As tranb3r said, Xamarin.Forms 5.0.0.2478 has a dependency on Xamarin.AndroidX.Core (>= 1.6.0.1 && <= 1.7.0.2)

My project has references to Xamarin.AndroidX.Activity 1.4.0.3 and Xamarin.AndroidX.RecyclerView 1.2.1.6.

There are two updates to these packages:

  • Xamarin.AndroidX.Activity 1.4.0.4
  • Xamarin.AndroidX.RecyclerView 1.2.1.7

Both of which reference Xamarin.AndroidX.Core >= 1.8.0.1. But then this can't be updated to because of the Xamarin.Forms dependency on Xamarin.AndroidX.Core >= 1.6.0.1 && <= 1.7.0.2

beeradmoore avatar Jun 21 '22 12:06 beeradmoore

Having the same issues as listed above. And this is preventing me from transitioning to .NET MAUI because I need to be on the latest Xamarin.Forms to do so successfully. Here is my error:

Xamarin.Forms 5.0.0.2478 requires Xamarin.AndroidX.Core (>= 1.6.0.1 && <= 1.7.0.2) but version Xamarin.AndroidX.Core 1.8.0.1 was resolved.

Both are the latest versions of each package basically meaning I can't update.

Rob97 avatar Jun 21 '22 22:06 Rob97

Here is my error:

Xamarin.Forms 5.0.0.2478 requires Xamarin.AndroidX.Core (>= 1.6.0.1 && <= 1.7.0.2) but version Xamarin.AndroidX.Core 1.8.0.1 was resolved.

As I said, this only shows a warning, so you may have configured "treat warnings as errors", so turn this off and continue compile if you get warnings.

MagicAndre1981 avatar Jun 22 '22 05:06 MagicAndre1981

Any update ? Since Xamarin.Forms is still supported, I think it should be updated to support the latest androidx packages, as often as possible.

tranb3r avatar Aug 24 '22 09:08 tranb3r

A bump to support Xamarin.AndroidX.Core 1.8.0.1 would be nice, then AndroidX.Framework 1.5.1 could be installed without doing it manually and that seems to fix some bugs that causes apps to crash.

The problem was related to the AndroidX.Fragment package and a fix was added in version 1.5.1 with was not possible to upgrade to out of the box (need manual upgrade due to the constraints) and the accompanying warning.

Upgrading to AndroidX.Fragment 1.5.1 fixed this issue for me #13895 Issue #14193 seems to be closely related to this issue and might be a duplicate.

tentom avatar Sep 01 '22 12:09 tentom

It's so damn frustrating not being able to update packages that depend on Xamarin.AndroidX.Core >= 1.8.0.1. Is there no workaround for this issue?

F-Goncalves avatar Oct 05 '22 11:10 F-Goncalves

Is there no workaround for this issue?

simply install the latest Xamarin AndroidX packages on your on to the Android project and ignore the NU1608 warnings

MagicAndre1981 avatar Oct 05 '22 13:10 MagicAndre1981

Any update ? Are you going to release an update of Xamarin.Forms and Xamarin.Essentials soon ?

tranb3r avatar Oct 25 '22 15:10 tranb3r

@tranb3r I figured it out. Here is the link. To update the packages, you will have to remove them completely and install the exact versions listed here: https://github.com/MicrosoftDocs/azure-dev-docs/issues/929

You will bump into further issues regarding the documentation and firebase code. The link above walks you through those.

Rob97 avatar Nov 22 '22 23:11 Rob97

Microsoft is now updating some AndroidX dependencies and this fix is scheduled for 5.0 SR13

MagicAndre1981 avatar Nov 23 '22 06:11 MagicAndre1981

@jfversluis

some AndroidX packages are now updated and again outside of dependency constraint:

NU1608: Detected package version outside of dependency constraint: Xamarin.Forms 5.0.0.2612 requires Xamarin.AndroidX.Lifecycle.LiveData (>= 2.3.1.1 && <= 2.6.1.1) but version Xamarin.AndroidX.Lifecycle.LiveData 2.6.2.1 was resolved.
NU1608: Detected package version outside of dependency constraint: Xamarin.Forms 5.0.0.2612 requires Xamarin.Google.Android.Material (>= 1.4.0.2 && < 1.9.0) but version Xamarin.Google.Android.Material 1.9.0.3 was resolved.
NU1608: Detected package version outside of dependency constraint: Xamarin.Forms 5.0.0.2612 requires Xamarin.AndroidX.Browser (>= 1.3.0.6 && < 1.6.0) but version Xamarin.AndroidX.Browser 1.6.0.1 was resolved.
NU1608: Detected package version outside of dependency constraint: Xamarin.Forms 5.0.0.2612 requires Xamarin.AndroidX.Navigation.UI (>= 2.3.5.1 && < 2.6.0) but version Xamarin.AndroidX.Navigation.UI 2.7.2.1 was resolved.

MagicAndre1981 avatar Sep 18 '23 07:09 MagicAndre1981

[...] ignore the NU1608 warnings

to me this shows as an error:

Severity	Code	Description	Project	File	Line	Suppression State
Error		Unable to resolve dependencies. 'Xamarin.AndroidX.Browser 1.6.0.1' is not compatible with 'Xamarin.Forms 5.0.0.2612 constraint: Xamarin.AndroidX.Browser (>= 1.3.0.6 && < 1.6.0)'.				

daef avatar Sep 26 '23 18:09 daef