Xamarin Essentials和Xamarin Forms程序包冲突

时间:2018-12-04 15:19:32

标签: xamarin xamarin.forms

当尝试将Xamarin.Forms和Xamarin.Essentials添加到我的android项目时,我得到了-

Resolving conflicts for MonoAndroid,Version=v8.1...
NU1107: Version conflict detected for Xamarin.Android.Support.Compat. 
Reference the package directly from the project to resolve this issue. 
abc.android -> Xamarin.Essentials 0.11.0-preview -> Xamarin.Android.Support.CustomTabs 27.0.2.1 -> Xamarin.Android.Support.Compat (= 27.0.2.1) 
abc.android -> Xamarin.Forms 3.4.0.1008975 -> Xamarin.Android.Support.v4 27.0.2 -> Xamarin.Android.Support.Compat (= 27.0.2).

看起来他们俩都想使用Xamarin.Android.Support.v4的27.0.2.1和27.0.2。

有人可以解释我如何解决此冲突吗? 我不确定直接引用该软件包意味着什么?

我可以在csproj中添加一些内容吗?

1 个答案:

答案 0 :(得分:0)

此后,我在Redth上找到了一篇非常不错的文章-

https://redth.codes/how-to-fix-the-dreaded-version-conflict-nuget-error-in-your-xamarin-android-projects/

我添加了-

<PackageReference Include="Xamarin.Android.Support.Compat" Version="27.0.2.1" />        
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="27.0.2.1" />        
<PackageReference Include="Xamarin.Android.Support.Annotations" Version="27.0.2.1" />       

已安装Essentials,但仍然收到这些警告-

Detected package version outside of dependency constraint: Xamarin.Android.Support.v4 27.0.2 requires Xamarin.Android.Support.Compat (= 27.0.2) but version Xamarin.Android.Support.Compat 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.v4 27.0.2 requires Xamarin.Android.Support.Core.Utils (= 27.0.2) but version Xamarin.Android.Support.Core.Utils 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.Design 27.0.2 requires Xamarin.Android.Support.Compat (= 27.0.2) but version Xamarin.Android.Support.Compat 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.Design 27.0.2 requires Xamarin.Android.Support.Core.Utils (= 27.0.2) but version Xamarin.Android.Support.Core.Utils 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.v7.AppCompat 27.0.2 requires Xamarin.Android.Support.Compat (= 27.0.2) but version Xamarin.Android.Support.Compat 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.v7.AppCompat 27.0.2 requires Xamarin.Android.Support.Core.Utils (= 27.0.2) but version Xamarin.Android.Support.Core.Utils 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.v7.CardView 27.0.2 requires Xamarin.Android.Support.Annotations (= 27.0.2) but version Xamarin.Android.Support.Annotations 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.Core.UI 27.0.2 requires Xamarin.Android.Support.Compat (= 27.0.2) but version Xamarin.Android.Support.Compat 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.Fragment 27.0.2 requires Xamarin.Android.Support.Compat (= 27.0.2) but version Xamarin.Android.Support.Compat 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.Fragment 27.0.2 requires Xamarin.Android.Support.Core.Utils (= 27.0.2) but version Xamarin.Android.Support.Core.Utils 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.Media.Compat 27.0.2 requires Xamarin.Android.Support.Compat (= 27.0.2) but version Xamarin.Android.Support.Compat 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.v7.RecyclerView 27.0.2 requires Xamarin.Android.Support.Compat (= 27.0.2) but version Xamarin.Android.Support.Compat 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.Transition 27.0.2 requires Xamarin.Android.Support.Compat (= 27.0.2) but version Xamarin.Android.Support.Compat 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.Transition 27.0.2 requires Xamarin.Android.Support.Core.Utils (= 27.0.2) but version Xamarin.Android.Support.Core.Utils 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.Vector.Drawable 27.0.2 requires Xamarin.Android.Support.Compat (= 27.0.2) but version Xamarin.Android.Support.Compat 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.v7.Palette 27.0.2 requires Xamarin.Android.Support.Compat (= 27.0.2) but version Xamarin.Android.Support.Compat 27.0.2.1 was resolved.
Detected package version outside of dependency constraint: Xamarin.Android.Support.v7.Palette 27.0.2 requires Xamarin.Android.Support.Core.Utils (= 27.0.2) but version Xamarin.Android.Support.Core.Utils 27.0.2.1 was resolved.

但是,我认为我可以在Redths解决方案中看到这些类型的错误,所以我认为我认为我们现在就可以了。