2016-06-12 99 views
9

我在Azure上部署了一台虚拟机。我已经安装了Visual Studio 2015,Xamarin和其他移动开发工具。 我在本地计算机上做了相同的设置,以在Visual Studio的设备上测试我的应用程序Xamarin:找不到与指定名称匹配的资源(AppCompat)

唯一的区别是安装Android SDK。在我的本地机器上,我没有图像系统。

Android DSK Manager

我开发我的虚拟机上的应用程序。编译期间我没有错误。 我使用Android.Support.Design,Android.Support.V4,Android.Support.V7.AppCompat,Android.Support.V7.RecyclerView(NuGet的最新版本)及其MvvmCross实现。

My Azure Virtual Machine

我想继续我的本地计算机上的应用程序的开发。 NuGet软件包已正确恢复。

当我建立的应用程序,我有一些错误:

My Local Machine

Error  Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  Error retrieving parent for item: No resource found that matches the given name 'Base.Widget.AppCompat.Button'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  No resource found that matches the given name: attr 'buttonStyle'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  No resource found that matches the given name: attr 'colorAccent'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  No resource found that matches the given name: attr 'colorPrimary'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  No resource found that matches the given name: attr 'colorPrimaryDark'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  No resource found that matches the given name: attr 'windowActionBar'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  No resource found that matches the given name: attr 'windowNoTitle'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  No resource found that matches the given name: attr 'windowNoTitle'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 

我试图

  • 通过改变'Theme.AppCompat.Light.DarkActionBar“@ android:styles/Theme.AppCompat.Light.DarkActionBar'和其他一些(android/styles)
  • 改变target=android-19target=android-21C:\Program Files (x86)\Android\android-sdk\extras\android\support\v7\appcompat\project.properties

有人能向我解释什么问题?我掉了。相同的操作系统,相同的工具,相同的SDK,相同的JDK,

+0

请清理和重建项目, –

回答

0

我从Xamarin组件切换到NuGet包,它现在可以工作。 MvvmCross为其依赖关系(MvvmCross.Droid.Support.V4,MvvmCross.Droid.Support.V7.AppCompat,MvvmCross.Droid.Support.V7.Preference ...)安装了最新版本的软件包Nuget(23.3.0)。和更早使用的组件。

我还必须从我的虚拟机复制“C:\ Users \ andres \ AppData \ Local \ Xamarin”文件夹。

在Visual Studio中,我没有通知组件可用的更新。

1

试试这个。

导航至C:\Program Files (x86)\Android\android-sdk\extras\android\support\v7\appcompat

打开project.properties文件。

将目标android更改为target=android-21

+0

已经尝试过(从目标=机器人-19) –

12

我在Mac上遇到了与Xamarin Studio相同的问题。我所做的解决这个问题的方法是更新NuGet软件包Xamarin.Android.Support.v7.AppCompat。我想你也可以使用相同的方法来解决你在Visual Studio上的问题。

看看
enter image description here

+0

我有最新版本(23.3.0) –

+1

我不得不删除整个支持库并重新添加它们 –

+1

不幸的是,它没有工作,因为它给了我这个消息: 正在更新'Xamarin.Android.Support.v7.AppCompat 23.3。 0'到'Xamarin.Android.Support.v7.AppCompat 23.4.0.1'失败。无法找到与'Xamarin.Android.Support.v7.AppCompat 23.4.0.1'兼容的'Xamarin.Forms'版本。 虽然Xamarin。Forms包更新到最新的 –

1

这些步骤:

的 “Xamarin.Android.Support.v7.AppCompat” 创建新的应用程序 enter image description here

然后点击右键,选择“更新”。

等待IDE完成更新并重建应用程序。 enter image description here

0

在我的情况,我能够在XML -> Schemas菜单添加android-layout-xml.xsdschemas.android.com.apk.res.android.xsd来解决这个问题(仅当在axml文件访问)。 对于这些文件的确切位置,我建议在计算机上进行搜索,因为它们不在Xamarin文件夹中,正如其他答案中所建议的那样。在我的情况下,他们在obj文件夹下的项目[obj -> Debug -> Schemas ...]

希望这会帮助你解决你的问题。

0

在我的情况下,问题是我有一个本地的Nuget包服务器。

花了我一段时间才意识到Xamarin Studio试图从错误的来源更新软件包。

5

在我的情况,“最小的Android版本” API 21,但“目标的Android版”是“利用目标框架版本(API 23)”,但它前面没有工作,那么我就将这两个版本都指向API 21,并且突然开始按预期工作。

后来我改变最小的Android版本是API 21和Target的Android版本为 “使用目标框架版本(API 23)”

0

尝试以下一项或所有这些:

  1. 解决方案包广恢复
  2. 重新启动Visual Studio
  3. 清洁&重建

它解决了我的问题

+0

它没有,我甚至不得不重新启动我的笔记本电脑。 – david

0

在我的情况下,匹配Xamarin.Support版本到Target Framework版本工作。

例如: 如果你的目标25 API那么你的支持库也应该是25.x ..

相关问题