Error: No resource found that matches the given name: attr

▼魔方 西西 提交于 2019-12-11 17:56:07

问题


I have an Xamarin.Forms app that fails to build for Android on my Mac (same on Windows) while it did work fine before (not sure what changed in the meantime). The same projects builds fine on the pc of a colleague.

It's a Xamarin.Forms app using PCL. I get the following errors in my styles.xml file:

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'.

This is what my styles.xml looks like:

<?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>

I can't figure out why it works for on my colleagues pc and not on mine. I've even tried installing ALL Android SDKs and other tools without any success.

I don't know how to continue. Any help is appreciated.

来源:https://stackoverflow.com/questions/46280933/error-no-resource-found-that-matches-the-given-name-attr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!