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

时间:2017-09-18 13:47:08

标签: android xamarin.forms xamarin.android

我有一个Xamarin.Forms应用程序无法在我的Mac上构建Android(在Windows上相同),而它之前工作正常(不确定在此期间发生了什么变化)。相同的项目在同事的电脑上构建得很好。

它是使用PCL的Xamarin.Forms应用程序。我在styles.xml文件中收到以下错误:

Resources/values/styles.xml(3): error APT0000:  Error: No resource found that matches the given name: attr 'colorAccent'.
    Resources/values/styles.xml(2): error APT0000:  Error: No resource found that matches the given name: attr 'colorPrimary'.
    Resources/values/styles.xml(2): error APT0000:  Error: No resource found that matches the given name: attr 'colorPrimaryDark'.
    Resources/values/styles.xml(2): error APT0000:  Error: No resource found that matches the given name: attr 'windowActionBar'.
    Resources/values/styles.xml(4): error APT0000:  Error: No resource found that matches the given name: attr 'windowActionModeOverlay'.
    Resources/values/styles.xml(2): error APT0000:  Error: No resource found that matches the given name: attr 'windowNoTitle'.

这就是我的styles.xml:

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

      <style name="MainTheme.Splash" parent ="android:Theme.Light">
        <item name="android:windowActionBar">false</item>
        <item name="android:windowTitleSize">0dp</item>
        <item name="android:windowBackground">@drawable/splash</item>
        <item name="android:windowNoTitle">true</item>
      </style>

      <style name="MainTheme" parent="MainTheme.Base">
      </style>
      <!-- Base theme applied no matter what API -->
      <style name="MainTheme.Base" parent="android:Theme.Light">
        <!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
        <item name="windowNoTitle">true</item>
        <!--We will be using the toolbar so no need to show ActionBar-->
        <item name="windowActionBar">false</item>
        <!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
        <!-- colorPrimary is used for the default action bar background -->
        <item name="colorPrimary">#2196F3</item>
        <!-- colorPrimaryDark is used for the status bar -->
        <item name="colorPrimaryDark">#1976D2</item>
        <!-- colorAccent is used as the default value for colorControlActivated
             which is used to tint widgets -->
        <item name="colorAccent">#FF4081</item>
        <!-- You can also set colorControlNormal, colorControlActivated
             colorControlHighlight and colorSwitchThumbNormal. -->
        <item name="windowActionModeOverlay">true</item>
      </style>
    </resources>

我无法弄清楚为什么它适用于我的同事电脑,而不是我的同事。我甚至尝试过安装所有Android SDK和其他工具而没有任何成功。

我不知道如何继续。任何帮助表示赞赏。

0 个答案:

没有答案