无法将Xamarin.Azure.NotificationHub.Android nuget安装到现有项目



当我试图将Xamarin.Azure.NotificationHub.Android nuget包安装到我现有的Xamarin.forms项目时,我遇到了以下错误。

在现有packages.config文件中检测到一个或多个未解析的包依赖关系约束。必须解析所有依赖关系约束才能添加或更新包。如果正在更新这些程序包,则可能会忽略此消息,否则以下错误可能会阻止当前程序包操作:"Xamarin.Forms 4.5.0.617 constraint:Xamarin.AndroidX.Lifecycle.LiveData(>=2.1.0(","Xamari.Forms 4.5.0.627 constraint:Xamarin.Google.Android.Material(>=1.0.0(",'Xamarin.Forms 4.5.0.617约束:Xamarin.AndroidX.Legacy.Support.V4(>=1.0.0

找不到与"Xamarin.Android.Arch.Core.Runtime 1.1.1.3 constraint:Xamari.Android.Aarch.Core.Common(=1.1.1.1.3("、"Xamari.Android.Arch.Lifecycle.LiveData 1.1.1.3 constriction:Xamarin.Android.Arch.Core(=1.1.1.1.3("兼容的"Xamarin.Android.Core.Common"版本,'Xamarin.Android.Arch.Lifecycle.LiveData.Core 1.1.1.3约束:Xamarin.Andoid.Arch.Core.Common(=1.1.1.1.3('。

但我的项目已经安装了Xamarin.Android.Arch.***1.1.1.3。

在将Xamarin.Azure.NotificationHub.Android nuget安装到新项目时,我没有遇到任何问题。当安装到我现有的Xamarin.Forms项目时出错,该项目已经使用了AppCenter。这是因为某些包依赖冲突吗?如果是,如何解决?

Xamarin.Azure.NotificationHub.Android (1.1.1)包使用Xamarin.GooglePlayServices.Base (>= 70.x.x)Xamarin.Firebase.Messaging (>= 70.x.x)作为依赖项。项目中安装的其中一个软件包也依赖于Xamarin.GooglePlayServices.Base软件包。Xamarin.Azure.NotificationHub.Android (1.1.1)包需要更高版本的GooglePlayservices.Base (>= 70.x.x)包。由于我的项目使用package.config文件来管理已安装的程序包,因此现有程序包已经安装了较低版本的GooglePlayservices.Base程序包(60.x.x(.

我能够通过两种方式解决这个问题:

  1. 卸载导致与其所有依赖项发生冲突的程序包。然后将"依赖关系行为"设置为"最低",重新安装程序包。然后我能够安装NotificationHub.Android软件包,没有任何错误。

  2. 从package.config迁移到新的PackageReference格式。通过这种方式,可以更容易地查看直接安装在项目上的包,并且不必担心依赖关系。这也显示了哪些包会产生冲突。按照错误日志的建议修复了该问题。

NU1107:检测到Xamarin.GooglePlayServices.Basement的版本冲突。将Xamarin.Google PlayServices.Base 71.1620.4直接安装/引用到项目XXX以解决此问题。XXX->Xamarin.Azure.NotificationHubs.Android 1.1.1->Xamarin.Firebase.Messaging 71.1740.4->Xamarin.GooglePlay服务地下室(>=71.1620.4(

最新更新