Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'

送分小仙女□ 提交于 2019-12-01 14:59:19

问题


I am getting this error in styles.xml:

Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.

In manifest:

<uses-sdk
    android:minSdkVersion="16"
    android:targetSdkVersion="21" />

Android Sdk Manager:

I am updated all the api 21 and extras.

In Order and Export:

values-v21/styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AppTheme" parent="android:Theme.Material.Light">

        <item name="android:colorPrimary">@color/primary</item>
        <item name="android:colorPrimaryDark">@color/primary_dark</item>
        <item name="android:colorAccent">@color/accent</item>
        <item name="android:textColorPrimary">@color/text_primary</item>
        <item name="android:textColor">@color/text_secondary</item>
        <item name="android:navigationBarColor">@color/primary_dark</item>

    </style>
</resources>  

Console:

E:\workspace\WelcomeToL\app\src\main\res\values-v21\styles.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.

E:\workspace\WelcomeToL\app\src\main\res\values-v21\styles.xml:7: error: Error: No resource found that matches the given name: attr 'android:colorAccent'.

E:\workspace\WelcomeToL\app\src\main\res\values-v21\styles.xml:5: error: Error: No resource found that matches the given name: attr 'android:colorPrimary'.

E:\workspace\WelcomeToL\app\src\main\res\values-v21\styles.xml:6: error: Error: No resource found that matches the given name: attr 'android:colorPrimaryDark'.

E:\workspace\WelcomeToL\app\src\main\res\values-v21\styles.xml:10: error: Error: No resource found that matches the given name: attr 'android:navigationBarColor'.

I didn't know why this error still occurs.Anybody can help me with this.Thank you.


回答1:


Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.

Material.Light theme require API level 21 for project. Set Project Build Target for project from Properties->Android->Project Build Target to API 21.



来源:https://stackoverflow.com/questions/27812302/error-retrieving-parent-for-item-no-resource-found-that-matches-the-given-name

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