AppCompat v7 r21在values.xml中返回错误?

我正在使用Android Studio,当我添加编译"com.android.support:appcompat-v7:21.0.0" 到我的Gradle文件,我得到了大量的错误:

C:\Users\WindowsSucks\AndroidStudioProjects\MMMeds\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\res\values-v11\values.xml
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
C:\Users\WindowsSucks\AndroidStudioProjects\MMMeds\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\res\values-v14\values.xml
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
C:\Users\WindowsSucks\AndroidStudioProjects\MMMeds\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\res\values-v21\values.xml
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'.
Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Menu'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.ActionBar'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Dark'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Dark.ActionBar'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Light'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.DropDownItem.Spinner'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.PopupMenu'.
Error:(298, 21) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListPopupWindow'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView.DropDown'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.PopupMenu'.
Error:(298, 21) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Toolbar.Button.Navigation'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Dialog'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.Dialog'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.

所有这些似乎都表现在:

\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\res\values-v11\values.xml

而且

\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\res\values-v21\values.xml
288895 次浏览

AppCompat v21构建的主题需要API 21 (Android 5.0)中提供的新API。要使用AppCompat编译应用程序,还必须根据API 21编译。使用API 21编译/构建的推荐设置是21compileSdkVersion21.0.1buildToolsVersion(这是目前最高的设置-你总是想使用最新的构建工具)。

当你转到你的sdk manager并选择Android 5.0时,Resource for android将是一个可用的选项。下载并安装。这将修复找不到资源的问题。

如果你使用android studio goto 文件——>项目结构 在属性选项卡中将编译Sdk版本到AP1 21和Build Tools Version更改为可用的最高版本。 然后刷新Gradle

在gradle中将compile 'com.android.support:appcompat-v7:21.0.0'更改为compile 'com.android.support:appcompat-v7:20.0.0'。构建对我来说很有用。

谁能像我一样解决问题,我就投票给谁。 我和你有同样的问题,我花了很多时间来纠正。

. Please test .

.

升级整个SDK,更新21.0.2版本也有谷歌服务播放的更新。 升级所有的事情。 在你的工作空间删除文件夹(android -support- v7 - AppCompat)和(谷歌-play - services_lib)

将这些项目重新导入IDE,并选择再次将它们复制到您的工作区。

项目(谷歌-play - services_lib)执行刷新和构建操作

**** *****问题 项目(android -support- v7 - AppCompat)标记5.0 API,然后刷新和构建

在他的项目中,在属性,android,导入库(android -support- v7 - AppCompat)和(谷歌-play - services_lib),然后刷新和构建。

确保这两个 您的项目文件夹和appcompat_v7文件夹的project.properties文件中的目标(它告诉目标android版本)的值是相同的(最好是最新的)。

:在` your_project'/project.properties中

<代码>目标= < >强android-21 android.library.reference.1 = . . / appcompat_v7 < /代码> < / p >

而且

:在appcompat_v7/project.properties内部

<代码>目标= < >强android-21 android.library = true < /代码> < / p >

在此之后,不要忘记清洁你的项目。

如果你不想使用API 21,你可以使用旧版本的appcompact库,使用旧版本的appcompact库而不更新它。

你可以通过以下简单的步骤来实现:

1)解压下载的完整sdk和eclipse bundle。

2)简单地从sdk\extras\android\support\v7\appcompact导入appCompact库

现在你完成了。

将编译SDk版本更改为API级别21,为我修复了它。然后我又遇到了将应用部署到我的设备上的其他问题。我改变了最小API级别的目标,我想要的,这就固定了它。

以防有人再次经历这种情况。

嗨,我有同样的错误涉及appcompatv7库,我做了@ianhanniballake建议并检查库的构建版本,通过选择它并点击鼠标的次要按钮,然后:

属性-> Android -> Android 5.0.1 api级别21

然后清理所有的项目,但我没有运气,所以在失去所有的希望后,我决定从日食开普勒升级到日食露娜。

在我等待下载完成的时候。我决定尝试另一件事,所以我从eclipse中删除appcompatv7库,并检查

删除磁盘上的项目内容。

打开Android SDK,检查是否有任何更新,然后通过选择我的项目和下面,我从我的项目中删除了所有库引用

项目->属性-> Android ->库部分

删除了所有库,包括导致此问题的库

Google_Play_Services_Lib

然后重启Eclipse并从Android SDK复制。appcompat文件夹来自:

android-sdk-linux /配件/ android /支持/ v7

到我的Eclipse工作空间,然后从导入现有项目工作空间导入到Eclipse,然后选择合适的构建工具版本

Android 5.0.1 api 21

添加了我所有的参考库,清理了所有的项目,一切都重新工作了。

我为我所有的参考库选择相同的构建工具。

希望这有助于!!!!

顺便说一下,我试着投了一票,但我没有足够的代表来做这件事。

检查添加谷歌播放服务在这里,因为我面临同样的问题,并删除了一切,然后按照步骤,让一切正常工作。

只需选择目标api级别21进行编译,单击应用 ->单击好吧清洁构建项目和运行它。

截图for same

我遇到了同样的问题,在我的构建中有正确的API级别值。gradle compileSdkVersion 21, targetSdkVersion 21和21.0.1的buildToolsVersion

然而,我是包括这作为一个模块在我的项目,所以我必须确保其他模块gradle设置匹配API 21。从那以后,一切都很顺利。

我的解决方案是与其他版本编译

构建。gradle(应用)

compileSdkVersion 21

祝你好运

将你的sdk编译改为23。这为我解决了问题。

我改变了

compile 'com.android.support:appcompat-v7:19.1.+'

compile 'com.android.support:appcompat-v7:22.1.+'

在构建。gradle和同步后,我没有得到任何错误

在我使用Eclipse IDE的情况下,我有同样的问题,解决方案是:
1-安装最新的可用API (SDK平台&谷歌api)
2-创建项目,设置如下:

  • Compile With:使用当时可用的最新API版本
  • 其他值可以根据您的要求接收值(在前面的注释中查看每个值的含义)

对我来说是这样的:

android {
compileSdkVersion 21
buildToolsVersion '23.0'


defaultConfig {
applicationId "nl.changer.polypickerdemo"
minSdkVersion 15
targetSdkVersion 21
---------
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'




}
< p >我修改: compileSdkVersion 21 buildToolsVersion“23.0” appcompat-v7:22.2.0 ' < / p >

我已经更新构建。gradle(模块:应用): 旧代码:< / p >

  compile 'com.android.support:appcompat-v7:23.0.1'

新代码:

 compile 'com.android.support:appcompat-v7:22.2.0'

工作为我在android工作室。

当我导入google服务时,我就遇到了这个问题。json文件来实现分析。我已经在xml文件夹中有global_tracker.xml文件。在构建过程中,合并来自google-services的内容。Json文件,错误开始发生。暂时,在删除google -services后,该错误将得到解决。json文件。使用旧的Analytics解决方案。

检查您编辑/导入的最后一个XML或Json文件,可能会出现文件错误。这对我很有帮助。

这帮助了我

  • 更新Android SDK到最新版本
  • 用最新的组件更新app/build.gradle:

    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    minSdkVersion 17
    targetSdkVersion 25
    

Hope this solves your problem

这对我来说很有效。转到android-support-v7-appcompat项目并打开文件“project. exe”。属性”,并插入这行,如果缺少:

target=android-25
compile=android-21

在我的一个phonegap项目中,我也面临着同样的问题。为了解决这个问题,我遵循了以下步骤

1)右键单击项目名称(在我的例子中是android),选择“打开模块设置”

2)选择模块(android和CordovaLib)

3)单击顶部的属性

4)选择编译SDK版本(我选择API 26: Android 8.0)

5)选择构建工具版本(我选择了26.0.2)

6)源兼容性(1.6)

7)目标兼容性(1.6)

单击Ok并重新构建项目。

还有一个额外的步骤

添加

编译“com.android.support: appcompat-v7:27.0.2”

构建。gradle(模块:android)

下面的链接显示了我所遵循的步骤的设置

https://app.box.com/s/itkkjz09wgy36jwowhvzcyx6fp7o2gkh