设置Xamarin.Forms-“找不到与给定名称匹配的资源..." [英] Setup Xamarin.Forms - "No resource found that matches the given name..."

查看:72
本文介绍了设置Xamarin.Forms-“找不到与给定名称匹配的资源..."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Xamarin.Forms(PCL,C#)项目模板构建一个新的Visual Studio项目,并且从"styles.xml"中收到一些找不到与给定名称匹配的资源..."错误. 文件.

I'm trying to build a new Visual Studio project from the Xamarin.Forms (PCL, C#) projects template and I get some "No resource found that matches the given name..." errors from the "styles.xml" file.

1>c:\users\[...]\documents\visual studio 15\Projects\XamForm041105\XamForm041105\XamForm041105.Droid\Resources\values\styles.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
1>c:\users\[...]\documents\visual studio 15\Projects\XamForm041105\XamForm041105\XamForm041105.Droid\Resources\values\styles.xml(3): error APT0000: No resource found that matches the given name: attr 'colorAccent'.
1>c:\users\[...]\documents\visual studio 15\Projects\XamForm041105\XamForm041105\XamForm041105.Droid\Resources\values\styles.xml(2): error APT0000: No resource found that matches the given name: attr 'colorPrimary'.
1>c:\users\[...]\documents\visual studio 15\Projects\XamForm041105\XamForm041105\XamForm041105.Droid\Resources\values\styles.xml(2): error APT0000: No resource found that matches the given name: attr 'colorPrimaryDark'.
1>c:\users\[...]\documents\visual studio 15\Projects\XamForm041105\XamForm041105\XamForm041105.Droid\Resources\values\styles.xml(2): error APT0000: No resource found that matches the given name: attr 'windowActionBar'.
1>c:\users\[...]\documents\visual studio 15\Projects\XamForm041105\XamForm041105\XamForm041105.Droid\Resources\values\styles.xml(4): error APT0000: No resource found that matches the given name: attr 'windowActionModeOverlay'.
1>c:\users\[...]\documents\visual studio 15\Projects\XamForm041105\XamForm041105\XamForm041105.Droid\Resources\values\styles.xml(2): error APT0000: No resource found that matches the given name: attr 'windowNoTitle'.
1>c:\users\[...]\documents\visual studio 15\Projects\XamForm041105\XamForm041105\XamForm041105.Droid\Resources\values\styles.xml(4): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'.
1>c:\users\[...]\documents\visual studio 15\Projects\XamForm041105\XamForm041105\XamForm041105.Droid\Resources\values\styles.xml(4): error APT0000: No resource found that matches the given name: attr 'colorAccent'.

最近我注意到这是Xamarin用户的常见问题,但是我找不到适合我项目的可行解决方案. 那么,我应该如何设置我的项目以使Xamarin.Forms正常工作??

I noticed this is a common problem for Xamarin users lately, but I couldn't find a working solution for my project. So, how should I setup my project in order for Xamarin.Forms to work?

这是我当前的配置,我应该尝试更改 e吗?

This is my current configuration, is there something I should try and change?

Visual Studio Enterprise 15 Preview 5
Xamarin Forms v2.3.2.127
Xamarin.Android.Support Library v23.3.0
Java jdk 1.8.0_92
Android NDK r11c
Android SDK Tools 25.2.2
Android SDK Platform-tools 25
Android SDK Build-tools 23.0.3
Android SDK Platform 23.3
Google APIs 23.1
Sources for Android SDK 23.1

请注意-阅读此帖子-我将Android SDK Build-tools从24降级到了23(并且无法正常工作),但我也尝试了很多Android SDK Build-tools与API的组合,但均无济于事.

Notice that - after reading this post - I downgrade my Android SDK Build-tools from 24 to 23 (and it's not working) but I also tried a lot of Android SDK Build-tools vs API combination but none worked.

推荐答案

所以,我发现了这个问题.如果将来某人应该遇到同样的问题,而又无法实施可以在网上找到的解决方案,那么这是另一个提示.

So, I figured this issue out. If someone should have this same problem in the future and couldn't solve it implementing the solutions you can find online, here's another tip.

解决方案:按照我在问题中链接的帖子中的解决方案2",下载 android_m2repository_r29.zip 文件,并将其放入%localappdata%\ Xamarin \ Xamarin.Android .Support.Animated.Vector.Drawable 文件夹(但我想一个文件夹和另一个文件夹一样好).然后重建Droid项目.而已! (在此过程结束时,您可以删除文件夹中的zip)

SOLUTION: following the "Solution 2" in the post I linked in my question, download the android_m2repository_r29.zip file and put in in the %localappdata%\Xamarin\Xamarin.Android.Support.Animated.Vector.Drawable folder (but my guess is one folder is as good as another). Then rebuild the Droid project. That's it! (At the end of the process, you can delete the zip in the folder)

在OSX/MacOS上:该文件夹位于/Users/[UserName]/.local/share/Xamarin

On OSX/MacOS: the folder is located in /Users/[UserName]/.local/share/Xamarin

这篇关于设置Xamarin.Forms-“找不到与给定名称匹配的资源..."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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