Xamarin跨平台(便携式类)项目编译错误 [英] Xamarin cross-platform (portable class) project compilation error

查看:102
本文介绍了Xamarin跨平台(便携式类)项目编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Visual Studio中的可移植类库创建了一个新的空白跨平台项目,但是当我尝试构建平台项目时,我有一个错误列表:

I made a new blank cross-platform project using a portable class library in visual studio, BUT when I try to build a platform project I have a list of errors:

Error   CS0117  'Resource' does not contain a definition for 'Animation'
Error   CS0117  'Resource' does not contain a definition for 'Boolean'
Error   CS0117  'Resource' does not contain a definition for 'Color'
Error   CS0117  'Resource' does not contain a definition for 'Dimension'
Error   CS0117  'Resource' does not contain a definition for 'Id'   App5.Droid
Error   CS0117  'Resource' does not contain a definition for 'Integer'
Error   CS0117  'Resource' does not contain a definition for 'Layout'
Error   CS0117  'Resource' does not contain a definition for 'Style'
Error   CS0117  'Resource' does not contain a definition for 'Styleable'
Error   CS0117  'Resource.Attribute' does not contain a definition for 'actionBarDivider'
Error   CS0117  'Resource.Attribute' does not contain a definition for 'actionBarItemBackground'
Error   CS0117  'Resource.Attribute' does not contain a definition for 'actionBarPopupTheme'
Error   CS0117  'Resource.Attribute' does not contain a definition for 'actionBarSize'
Error   CS0117  'Resource.Attribute' does not contain a definition for 'actionBarSplitStyle'

请记住,我正在尝试更新NuGet软件包,但是当我选择所有带有(Xamarin.forms)的软件包时,更新无法正常工作,并且出现以下错误:

Keep in mind that I'm trying to update NuGet Packages, BUT when I selected all packages with (Xamarin.forms), the update didn't work and the following error appeared:

Unable to find a version of 'Xamarin.Android.Support.v4' that is compatible with 'Xamarin.Android.Support.Animated.Vector.Drawable 23.2.1 constraint: Xamarin.Android.Support.v4 (= 23.2.1)', 'Xamarin.Android.Support.Design 23.0.1.3 constraint: Xamarin.Android.Support.v4 (>= 23.0.1.3)', 'Xamarin.Android.Support.v13 23.3.0 constraint: Xamarin.Android.Support.v4 (= 23.3.0)', 'Xamarin.Android.Support.v7.AppCompat 23.0.1.3 constraint: Xamarin.Android.Support.v4 (>= 23.0.1.3)', 'Xamarin.Android.Support.v7.MediaRouter 23.0.1.3 constraint: Xamarin.Android.Support.v4 (>= 23.0.1.3)', 'Xamarin.Android.Support.v7.RecyclerView 23.0.1.3 constraint: Xamarin.Android.Support.v4 (>= 23.0.1.3)', 'Xamarin.Android.Support.Vector.Drawable 23.2.1 constraint: Xamarin.Android.Support.v4 (= 23.2.1)', 'Xamarin.Forms 2.1.0.6529 constraint: Xamarin.Android.Support.v4 (= 23.0.1.3)'.

因此,我选择了除Xamarin.forms软件包以外的所有软件包,并对其进行了更新.

So, I selected all packages except the Xamarin.forms package and updated them.

关于如何解决此错误的任何想法?

Any idea on how to fix this error?

推荐答案

您需要使用错误消息中提到的特定/最低版本的软件包.最安全的方法是删除所有nuget软件包(包括Xamarin.Forms),然后添加Xamarin.Forms nuget软件包,这将在特定版本中添加其所有依赖项.

You need to use the specific/minimium versions of the packages that are mentioned in the error message. The safest way to do it is to remove all nuget packages (including Xamarin.Forms) and then add Xamarin.Forms nuget package, which will add all its dependencies with the specific versions.

解释,通过詹姆斯·蒙特马尼诺(James Montemagno):

Xamarin.Forms锁定了非常特定的支持版本 图书馆和Google Play服务.您无法更新它们,因为 Xamarin.Forms与它们不兼容,因为它需要与 重新编译.

Xamarin.Forms locks in a very specific version of the support libraries and google play services. You can't update them because Xamarin.Forms isn't compatible with them as it would need to be re-compiled.

Xamarin.Android.Support.v4(= 23.0.1.3)

Xamarin.Android.Support.v4 (= 23.0.1.3)

Xamarin.Android.Support.Design(= 23.0.1.3)

Xamarin.Android.Support.Design (= 23.0.1.3)

Xamarin.Android.Support.v7.AppCompat(= 23.0.1.3)

Xamarin.Android.Support.v7.AppCompat (= 23.0.1.3)

Xamarin.Android.Support.v7.CardView(= 23.0.1.3)

Xamarin.Android.Support.v7.CardView (= 23.0.1.3)

Xamarin.Android.Support.v7.MediaRouter(= 23.0.1.3)

Xamarin.Android.Support.v7.MediaRouter (= 23.0.1.3)

请参阅= 23.0.1.3,这意味着它仅与 版本号.这就是NuGet的工作方式.当Xamarin.Forms 更新这些软件包将自动更新.

See the = 23.0.1.3, which means it is only compatible with that version number. This is just how NuGet works. When Xamarin.Forms updates these packages will auto update.

这篇关于Xamarin跨平台(便携式类)项目编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆