检索项目的父项时出错:找不到与给定名称"android:Theme.Material.Light"匹配的资源

Luf*_*ffy 9 android android-styles android-5.0-lollipop

我在styles.xml中收到此错误:

检索项目的父项时出错:找不到与给定名称"android:Theme.Material.Light"匹配的资源.

在清单中:

<uses-sdk
    android:minSdkVersion="16"
    android:targetSdkVersion="21" />
Run Code Online (Sandbox Code Playgroud)

Android Sdk经理:

我更新了所有的api 21和额外内容.

在此输入图像描述

在此输入图像描述

在订单和出口:

在此输入图像描述

值-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>  
Run Code Online (Sandbox Code Playgroud)

安慰:

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'.
Run Code Online (Sandbox Code Playgroud)

我不知道为什么这个错误仍然存​​在.任何人都可以帮助我.谢谢.

ρяσ*_*я K 9

检索项目的父项时出错:找不到与给定名称"android:Theme.Material.Light"匹配的资源.

Material.Light主题需要API级别21的项目.设置项目构建目标的项目,从Properties->Android->Project Build TargetAPI 21.