I get the following error:
Error NU1107 Version conflict detected for Xamarin.AndroidX.Lifecycle.LiveData.
Install/reference Xamarin.AndroidX.Lifecycle.LiveData 2.4.1.1 directly to project MyProject.Android to resolve this issue.
MyProject.Android -> Xamarin.GooglePlayServices.Ads 121.2.0 -> Xamarin.GooglePlayServices.Ads.Lite 121.2.0 -> Xamarin.AndroidX.Work.Runtime 2.7.1.3 -> Xamarin.AndroidX.Lifecycle.LiveData (>= 2.4.1.1)
MyProject.Android -> Xamarin.Forms 5.0.0.2515 -> Xamarin.AndroidX.Lifecycle.LiveData (>= 2.3.1.1 && < 2.4.0).
Which packages should I upgrade or downgrade in order to achieve compatibility?
CodePudding user response:
I have created a new project to test the packages you mentioned. And I found two solutions:
Just use the following package in your project's android part:
- Xamarin.AndroidX.Browser version 1.4.0.1
- Xamarin.AndroidX.Lifecycle.LiveData version 2.4.1.1
- Xamarin.GooglePlayServices.Ads version 121.2.0
- Xamarin.Forms version 5.0.0.2515
This solution just adds the reference to the project's android part according to the error messages. And the project will build successfully even though there are still some warnings about the package.
The second solution:
- use the Xamarin.Forms version 5.0.0.2545
- and the Xamarin.GooglePlayServices.Ads version 120.4.0
The Xamarin.GooglePlayServices.Ads version 120.4.0 is the newest version which is compatible with the Xamarin.AndroidX.Browser (>= 1.3.0.6 && < 1.4.0). If you use the two packages above, there will not be any warnings or errors about the reference.
CodePudding user response:
If you can, you should upgrade to Xamarin.Forms 5.0.0.2545. It allows for LiveData to be high enough. It's a minor upgrade for XF, so it shouldn't cause you any issues to upgrade.
If for whatever reason you can't upgrade Xamarin Forms, you'll need to downgrade GooglePlayServices.Ads to a version that allows for the lower Work.Runtime version which in turn allows for the lower LiveData version.