检索项目的父项时出错:找不到与给定名称'android:Theme.Material.Light'相匹配的资源 [英] Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'

查看:89
本文介绍了检索项目的父项时出错:找不到与给定名称'android:Theme.Material.Light'相匹配的资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

检索项目的父项时出错:找不到与以下项匹配的资源 命名为"android:Theme.Material.Light".

清单中

:

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

Android Sdk Manager:

我更新了所有的api 21和其他功能.

订购和出口:

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>  

控制台:

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

我不知道为什么仍然会发生此错误.任何人都可以帮助我.谢谢.

解决方案

检索项目的父项时出错:找不到与以下项匹配的资源 命名为"android:Theme.Material.Light".

Material.Light主题要求项目的API级别为21.将项目从Properties->Android->Project Build Target设置为API 21项目构建目标.

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.

解决方案

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.

这篇关于检索项目的父项时出错:找不到与给定名称'android:Theme.Material.Light'相匹配的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆