在新工作区构建项目时出现错误

12

我是Android开发的新手。我尝试创建一个Target SDK为API 21并使用API 19编译的新工作区。我已经安装了API 19和20的SDK,但没有安装Android5。我创建了一个新工作区,并创建了一个新项目,在创建项目后编译时遇到以下错误。有人能帮我解决这个问题吗?

错误详情:

Description Resource Path Location Type error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'. themes_base.xml /appcompat_v7/res/values-v11 line 352 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'. themes_base.xml /appcompat_v7/res/values-v11 line 345 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'. themes_base.xml /appcompat_v7/res/values-v11 line 359 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'. themes_base.xml /appcompat_v7/res/values-v11 line 338 Android AAPT Problem The project cannot be built until build path errors are resolved SampleApp Unknown Java Problem error: Error: No resource found that matches the given name: attr 'android:colorControlNormal'. themes_base.xml /appcompat_v7/res/values-v21 line 193 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorControlHighlight'. themes_base.xml /appcompat_v7/res/values-v21 line 195 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorPrimaryDark'. themes_base.xml /appcompat_v7/res/values-v21 line 191 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorPrimary'. themes_base.xml /appcompat_v7/res/values-v21 line 190 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'. styles_base.xml /appcompat_v7/res/values-v21 line 174 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Toolbar.Button.Navigation'. styles_base.xml /appcompat_v7/res/values-v21 line 93 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Subtitle'. styles_base.xml /appcompat_v7/res/values-v21 line 168 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'. styles_base.xml /appcompat_v7/res/values-v21 line 172 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'. styles_base.xml /appcompat_v7/res/values-v21 line 97 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'. styles_base.xml /appcompat_v7/res/values-v21 line 101 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView'. styles_base.xml /appcompat_v7/res/values-v21 line 121 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView.DropDown'. styles_base.xml /appcompat_v7/res/values-v21 line 107 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:overlapAnchor'. styles_base.xml /appcompat_v7/res/values-v21 line 138 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListPopupWindow'. styles_base.xml /appcompat_v7/res/values-v21 line 126 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material'. themes_base.xml /appcompat_v7/res/values-v21 line 202 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'. styles_base_text.xml /appcompat_v7/res/values-v21 line 62 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'. styles_base.xml /appcompat_v7/res/values-v21 line 113 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'. styles_base_text.xml /appcompat_v7/res/values-v21 line 20 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'. styles_base.xml /appcompat_v7/res/values-v21 line 182 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.DropDownItem.Spinner'. styles_base.xml /appcompat_v7/res/values-v21 line 110 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'. styles_base.xml /appcompat_v7/res/values-v21 line 115 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Dark.ActionBar'. themes_base.xml /appcompat_v7/res/values-v21 line 223 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'. styles_base.xml /appcompat_v7/res/values-v21 line 154 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'. styles_base_text.xml /appcompat_v7/res/values-v21 line 26 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.ActionBar'. themes_base.xml /appcompat_v7/res/values-v21 line 219 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'. styles_base.xml /appcompat_v7/res/values-v21 line 150 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'. styles_base_text.xml /appcompat_v7/res/values-v21 line 28 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Dark'. themes_base.xml /appcompat_v7/res/values-v21 line 205 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'. styles_base_text.xml /appcompat_v7/res/values-v21 line 22 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Title'. styles_base.xml /appcompat_v7/res/values-v21 line 164 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Light'. themes_base.xml /appcompat_v7/res/values-v21 line 212 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'. styles_base.xml /appcompat_v7/res/values-v21 line 158 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'. styles_base_text.xml /appcompat_v7/res/values-v21 line 24 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'. styles_base_text.xml /appcompat_v7/res/values-v21 line 34 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.PopupMenu'. styles_base.xml /appcompat_v7/res/values-v21 line 129 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorControlNormal'. themes_base.xml /appcompat_v7/res/values-v21 line 82 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:overlapAnchor'. styles_base.xml /appcompat_v7/res/values-v21 line 143 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'. styles_base_text.xml /appcompat_v7/res/values-v21 line 36 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorControlHighlight'. themes_base.xml /appcompat_v7/res/values-v21 line 84 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'. styles_base.xml /appcompat_v7/res/values-v21 line 146 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'. styles_base_text.xml /appcompat_v7/res/values-v21 line 30 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorControlActivated'. themes_base.xml /appcompat_v7/res/values-v21 line 83 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'. styles_base_text.xml /appcompat_v7/res/values-v21 line 32 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.PopupMenu'. styles_base.xml /appcompat_v7/res/values-v21 line 132 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorAccent'. themes_base.xml /appcompat_v7/res/values-v21 line 81 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'. styles_base_text.xml /appcompat_v7/res/values-v21 line 60 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'. styles_base.xml /appcompat_v7/res/values-v21 line 29 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorAccent'. themes_base.xml /appcompat_v7/res/values-v21 line 118 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'. styles_base.xml /appcompat_v7/res/values-v21 line 33 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'. styles_base_text.xml /appcompat_v7/res/values-v21 line 42 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorControlActivated'. themes_base.xml /appcompat_v7/res/values-v21 line 120 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'. styles_base_text.xml /appcompat_v7/res/values-v21 line 40 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'. styles_base.xml /appcompat_v7/res/values-v21 line 37 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorPrimary'. themes_base.xml /appcompat_v7/res/values-v21 line 79 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'. styles_base_text.xml /appcompat_v7/res/values-v21 line 38 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'. styles_base.xml /appcompat_v7/res/values-v21 line 41 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorPrimaryDark'. themes_base.xml /appcompat_v7/res/values-v21 line 80 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'. styles_base_text.xml /appcompat_v7/res/values-v21 line 52 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'. styles_base.xml /appcompat_v7/res/values-v21 line 75 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorPrimary'. themes_base.xml /appcompat_v7/res/values-v21 line 116 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'. styles_base.xml /appcompat_v7/res/values-v21 line 79 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'. styles_base_text.xml /appcompat_v7/res/values-v21 line 50 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorPrimaryDark'. themes_base.xml /appcompat_v7/res/values-v21 line 117 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'. styles_base_text.xml /appcompat_v7/res/values-v21 line 48 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'. styles_base.xml /appcompat_v7/res/values-v21 line 83 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorControlHighlight'. themes_base.xml /appcompat_v7/res/values-v21 line 121 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'. styles_base.xml /appcompat_v7/res/values-v21 line 25 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'. styles_base_text.xml /appcompat_v7/res/values-v21 line 46 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorControlNormal'. themes_base.xml /appcompat_v7/res/values-v21 line 119 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'. styles_base.xml /appcompat_v7/res/values-v21 line 53 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorControlHighlight'. themes_base.xml /appcompat_v7/res/values-v21 line 158 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'. styles_base.xml /appcompat_v7/res/values-v21 line 57 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'. styles_base_text.xml /appcompat_v7/res/values-v21 line 58 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorControlNormal'. themes_base.xml /appcompat_v7/res/values-v21 line 156 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'. styles_base_text.xml /appcompat_v7/res/values-v21 line 56 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'. styles_base.xml /appcompat_v7/res/values-v21 line 61 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorAccent'. themes_base.xml /appcompat_v7/res/values-v21 line 155 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'. styles_base_text.xml /appcompat_v7/res/values-v21 line 54 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'. styles_base.xml /appcompat_v7/res/values-v21 line 178 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorControlActivated'. themes_base.xml /appcompat_v7/res/values-v21 line 157 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'. styles_base.xml /appcompat_v7/res/values-v21 line 65 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorAccent'. themes_base.xml /appcompat_v7/res/values-v21 line 192 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'. styles_base.xml /appcompat_v7/res/values-v21 line 69 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorControlActivated'. themes_base.xml /appcompat_v7/res/values-v21 line 194 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Menu'. styles_base.xml /appcompat_v7/res/values-v21 line 45 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorPrimary'. themes_base.xml /appcompat_v7/res/values-v21 line 153 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:colorPrimaryDark'. themes_base.xml /appcompat_v7/res/values-v21 line 154 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'. styles_base.xml /appcompat_v7/res/values-v21 line 49 Android AAPT Problem The container 'Android Dependencies' references non existing library 'D:\Workspace\appcompat_v7\bin\appcompat_v7.jar' SampleApp Build path Build Path Problem error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'. themes_base.xml /appcompat_v7/res/values-v14 line 37 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'. themes_base.xml /appcompat_v7/res/values-v14 line 29 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'. themes_base.xml /appcompat_v7/res/values-v14 line 53 Android AAPT Problem error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'. themes_base.xml /appcompat_v7/res/values-v14 line 45 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material'. themes_base.xml /appcompat_v7/res/values-v21 line 26 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'. themes_base.xml /appcompat_v7/res/values-v21 line 31 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Dialog'. themes_base.xml /appcompat_v7/res/values-v21 line 36 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.Dialog'. themes_base.xml /appcompat_v7/res/values-v21 line 41 Android AAPT Problem

11个回答

21
  1. appcompat v7project.properties 文件中的 target=android-19 更新为 target=android-21

  2. 同时更新 Google Play服务 库(通过在 SDK管理器 中更新并重新导入等方式)


1
#1 对我来说解决了这个问题。appcompat_v7项目针对4.4.2版本,因此无法链接v21 libs库。感谢您指明正确方向! - Grant Amos

16

右键单击项目属性并将项目构建目标更改为5.0。

在此输入图片描述

在您的清单中将target = android-21更改为5.0。


然后清理项目。 - joninx
即使这样做了,我仍然遇到相同的错误。 - Narendra Singh
如果您选择使用Google API,请检查您的SDK(SDK管理器)是否已安装Google API。 - krishnan muthiah pillai

3

使用Android 5.0 API Level 21编译项目。


2

我认为这是一个错误。

我刚刚验证了使用Android支持库20版本(使用SDK至14)可以正常创建新的Hello World应用程序(标准默认设置)。 但是,如果使用21.0.3,则会出现与您上面发布的完全相同的错误。


1
我遇到了与某些新安装 Android 工具的人类似的错误,并错误地在 Android SDK Manager 中选择了 4.4W 和 4.4.2。
这会导致同时安装 API 20 和 API 19,这意味着 API 20 似乎更新,并且将默认用于新项目。
但是,API 20 仅适用于可穿戴设备。
您可以在此处查看 screenshot of Navigator Properties,其中 4.4W 已出现在路径中。
appcompat_v7 和 HelloAndy 项目目标都存在此路径问题。
我编辑了这两个项目的 project.properties 并将 target = android-20 更改为 target=android-19,然后对两个项目进行了刷新(右键单击 appcompat_v7 和其他项目)。 这将更新构建路径以指向正确的 Android SDK。

0

您的编译设置应该与您的目标设置相同或更晚。如果您尝试使用不理解api 21的工具来定位api 21,那么当它无法正常工作时,您不应感到惊讶。


0

0

另外一件你可以尝试的事情是打开 android-support-v7-appcompat 的 project.properties 文件并更改目标 target。然后只需执行 Project --> Clean,以使更改生效。


0

更改工作区,您的错误肯定会被纠正。

Android应用程序v7库中存在一些错误。

创建一个新的工作区,然后创建一个项目。使用相同的步骤,这次您将不会发现错误。


Eclipse工作区与项目编译无关。看看调试行……只有V21中的行存在问题,这意味着您需要至少使用android-21进行编译。更改工作区对问题没有影响,这只是意味着您的项目中有一个脏的/bin目录,可以通过project->clean进行清理。 - Lettings Mall

0

我曾经遇到同样的问题,并尝试了stackoverflow上提供的所有解决方案,但它们都对我无效。最终我找到了这个解决方案

https://dev59.com/3-o6XIcBkEYKwwoYIAgL#33505965

对我来说,它起作用了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接