繁体   English   中英

找不到与给定名称匹配的资源

[英]No resource found that matches the given names

我将构建一个Xamarin应用程序但是当我开始构建Android项目时,编译器给出了9个错误:

9个错误:找不到与给定名称匹配的资源:

  1. attr windowNoTitle
  2. attr colorPrimaryDark
  3. attr windowActionBar
  4. attr windowActionModeOverlay
  5. attr colorAccent
  6. attr colorPrimary
  7. attr colorAccent
  8. Theme.AppCompat.Light.Dialog
  9. Theme.AppCompat.Light.DarkActionBar

注意:错误发生在Project.Droid项目的文件styles.xml中。

在这里你可以找到styles.xml文件:

<?xml version="1.0" encoding="utf-8" ?>
<resources>

  <style name="MainTheme" parent="MainTheme.Base">
  </style>

  <style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">#2196F3</item>
    <item name="colorPrimaryDark">#1976D2</item>
    <item name="colorAccent">#FF4081</item>
    <item name="windowActionModeOverlay">true</item>
    <item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
  </style>

  <style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
    <item name="colorAccent">#FF4081</item>
  </style>

</resources>

我在SmartBox.Droid项目中没有任何改变,但是出现了这个错误。 问题是否发生是因为我在SmartBox (Portable)项目中添加了MainPage.xamlMap.xaml 我需要两页,因为我将在两页之间导航。

我在谷歌和搜索引擎优化的各个地方都进行了搜索,但没有找到能帮助我的解 我可以在GitHub( https://github.com/HeinPauwelyn/SmartBox )的文件夹Execution→SmartBox中找到我的源代码

请试试这个解决方案:

  1. 将您的Xamarin更新到最新版本(共享项目和您的平台项目)。

  2. 然后重定向到C:\\Users\\<username>\\AppData\\Local\\并将Xamarin文件夹重命名为Xamarin_old

  3. 重新打开您的项目,然后构建它。 完全下载软件包需要几分钟。

尝试在Resources / Layout文件夹中的Tabbar.axmlToolbar.axml编辑以下行。 这对我有用。

Tabbar.axml

从:

android:background="@style/colorPrimary"
app:tabIndicatorColor="@color/white"

至:

android:background="?attr/colorPrimary"
app:tabIndicatorColor="@android:color/white"

Toolbar.axml

从:

android:background="@style/colorPrimary"

至:

android:background="?attr/colorPrimary"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM