appcompat_v7:检索项目的父项时出错:找不到与给定名称匹配的资源 [英] appcompat_v7: Error retrieving parent for item: No resource found that matches the given name
问题描述
我正在尝试构建使用 appcompat_v7 库的 Android 项目.
I am trying to build the Android project that uses appcompat_v7 library.
为此,我通过 Eclipse -> New Android Sample Project 创建了我的项目并添加了我的自定义 style.xml,然后添加了 appcompat_v7 库项目 -> 属性 -> Android -> 添加.
For that, I created my project through Eclipse -> New Android Sample Project and added my custom styles.xml and then added the appcompat_v7 library Project -> Properties -> Android -> Add.
但是当我编译我的项目时,我在 appcompat_v7/res/values/styles_base.xml 中收到以下错误:
But I am getting the following errors in appcompat_v7/res/values/styles_base.xml when I compile my project:
appcompat_v7/res/values/styles_base.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
appcompat_v7/res/values/styles_base.xml:84: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
appcompat_v7/res/values/styles_base.xml:166: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
appcompat_v7/res/values/styles_base.xml:243: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
appcompat_v7/res/values/styles_base.xml:261: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base.DropDownItem'.
appcompat_v7/res/values/styles_base.xml:319: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
appcompat_v7/res/values/styles_base.xml:323: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Light.Base'.
appcompat_v7/res/values/styles_base.xml:347: error: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Base'.
appcompat_v7/res/values/styles_base.xml:391: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
appcompat_v7/res/values/themes_base.xml:189: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Base'.
在我的清单中,我将 14 声明为 minSdkVersion,将 19 声明为 targetSdkVersion:
In my manifest I have declared 14 as my minSdkVersion and 19 as targetSdkVersion:
AndroidManifest.xml:
AndroidManifest.xml:
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
我该怎么做才能修复这些错误并构建我的项目?
What can I do to fix these errors and build my project?
推荐答案
检查您的项目和 appcompat_v7 库项目的构建目标.它们应该是相同的,如果您的项目的 Build Target 少于您收到此错误并且将无法构建.
Check Build Target of your project and appcompat_v7 library project. They should be same, if your project has lesser Build Target than you get this error and won't be able to build.
要解决 Eclipse 中的问题,请转到 Project->Properties->Android (Project Build Target) 并选择等于您的 appcompat 库项目.
To fix the problem in Eclipse go to Project->Properties->Android (Project Build Target) and select equal to your appcompat library project.
这篇关于appcompat_v7:检索项目的父项时出错:找不到与给定名称匹配的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!