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

时间:2014-10-20 00:52:21

标签: android android-studio android-appcompat

我使用Android Studio,当我将compile "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

23 个答案:

答案 0 :(得分:427)

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

答案 1 :(得分:43)

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

:在'your_project'/ project.properties

target=android-21 android.library.reference.1=../appcompat_v7

:在appcompat_v7 / project.properties内部

target=android-21 android.library=true

此后不要忘记清理您的项目。

答案 2 :(得分:18)

在gradle.build中将compile 'com.android.support:appcompat-v7:21.0.0'更改为compile 'com.android.support:appcompat-v7:20.0.0'对我有效。

答案 3 :(得分:12)

如果你正在使用android studio goto 档案 - >项目结构 在属性标签中,将将Sdk版本编译为AP1 21 并将构建工具版本更改为最高可用版本。 然后刷新Gradle

答案 4 :(得分:7)

将complie SDk版本更改为API级别21为我修复了它。然后我遇到了将应用程序部署到我的设备的其他问题。我将minimun API级别更改为我想要的目标并修复它。

让某人再次体验到这一点。

答案 5 :(得分:4)

只需选择目标api级别 21 进行编译,然后点击应用 - >点击确定清除构建项目,然后运行

Screenshot for same

答案 6 :(得分:4)

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

build.gradle(app)

compileSdkVersion 21

祝你好运

答案 7 :(得分:4)

编译sdk 更改为 23 。这为我修好了。

答案 8 :(得分:3)

我投票谁能像我一样解决。 我和你有同样的问题,我花了很多时间才弄清楚。 请测试。

升级整个SDK,更新21.0.2版本还包含来自Google服务的更新。 升级一切。 在您的工作区中删除文件夹(android -support-v7-AppCompat)和(google -play-services_lib)

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

项目(google -play-services_lib)执行“刷新和构建”

的操作

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

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

答案 9 :(得分:3)

如果您不想使用API​​ 21,可以使用较旧版本的appcompact库,使用较旧的app紧凑库而不进行更新。

您只需按照以下步骤即可实现此目的:

1)提取完整的sdk和eclipse包的下载版本。

2)只需从sdk\extras\android\support\v7\appcompact

导入appCompact库

现在你已经完成了。

答案 10 :(得分:3)

引自here

  

要解决此问题,

     
      
  1. 右键单击appcompat_v7库,然后选择属性
  2.   
  3. 现在,点击Android Option,
  4.   
  5. 将项目构建路径设置为Android 5.0(API级别21)
  6.   
  7. 应用更改。
  8.   
  9. 现在转到project.properties
  10. 下的appcompat_v7文件   
  11. 将项目目标设置为:target=android-21
  12.   
  13. 现在清理+构建appcompat_v7库和您的项目
  14.   

答案 11 :(得分:2)

我更新了build.gradle(Module:app): 旧代码:

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

新守则:

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

在android studio中为我工作。

答案 12 :(得分:1)

这对我很有用。转到android-support-v7-appcompat项目并打开文件" project.properties"如果缺少则插入这一行:



target=android-25
compile=android-21




答案 13 :(得分:1)

当我导入google-services.json文件以实施Google Analytics时,我遇到了这个问题。我已经在xml文件夹中有了global_tracker.xml文件。在构建期间,在合并google-services.json文件中的内容时,错误已开始发生。暂时,删除goolgle-services.json文件后会解决错误。并使用较旧的Analytics解决方案。

检查您编辑/导入的最后一个XML或Json文件,也许您会在那里提交错误。这对我的情况有帮助。

答案 14 :(得分:1)

这帮了我

  • 将Android SDK更新为最新版本
  • 使用最新组件更新app/build.gradle

    compileSdkVersion 25  
    buildToolsVersion "25.0.2"  
    minSdkVersion 17  
    targetSdkVersion 25
    

希望这能解决您的问题

答案 15 :(得分:1)

我遇到了同样的问题,并且在我的build.gradle compileSdkVersion 21,targetSdkVersion 21和buildToolsVersion 21.0.1

中有正确的API级别值

但是,我将此作为模块包含在我的项目中,因此我必须确保其他模块的gradle设置与API 21相匹配。之后,这一切都对我有用。

答案 16 :(得分:1)

I was facing the same issue for one of my phonegap project. To resolve this I have followed , following step

1) Right click on Project name (In my Case android) , select "Open Module Settings"

2) Select modules (android and CordovaLib)

3) Click properties on top

4) Chose Compile SDK version (I have chosen API 26: Android 8.0 )

5) Choose Build Tools Version (I have chosen 26.0.2)

6) Source Compatibility ( 1.6)

7) Target Compatibility ( 1.6)

Click Ok and rebuild project.

Also one more additional step

Add

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

build.gradle (Module:android)

Following link shows my setting for step I have followed

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

答案 17 :(得分:1)

对我来说,这是:

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'


}

我修改了: compileSdkVersion 21 buildToolsVersion '23 .0' 程序兼容性-V7:22.2.0'

答案 18 :(得分:1)

在我使用Eclipse IDE的情况下,我遇到了同样的问题,解决方案是:
1-安装最新的API(SDK平台和Google API)
2-使用以下设置创建项目:

        
  • 编译:使用当时可用的最新API版本
  •     
  • 其他值可以根据您的要求接收值(查看以前评论中每个值的含义)

答案 19 :(得分:1)

我改变了

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

进入

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

在build.gradle中并且在同步之后我没有收到任何错误

答案 20 :(得分:1)

检查添加Google Play服务here,因为我遇到了同样的问题并删除了所有内容,然后按照步骤操作,让一切正常。

答案 21 :(得分:1)

您好我在appcompatv7库中遇到了相同的错误,我按照@ianhanniballake的建议进行了检查,并检查了库的构建版本,选择它并点击鼠标的辅助按钮然后:

  

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

然后清理所有项目,但我没有运气,所以在失去所有希望后,我决定从Eclipse Kepler升级到Eclipse Luna。

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

  

删除磁盘上的项目内容。

打开Android SDK以检查是否有任何更新,然后通过选择我的项目并在

下删除了我项目中的所有库引用
  

项目 - >属性 - > Android - >图书馆部分

删除了所有库,包括启动所有此问题的库

  

Google_Play_Services_Lib

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

  

Android的SDK-LINUX /额外/机器人/支撑/ V7

到我的eclpse工作区,然后从工业区中的Import exsting项目将其导入Eclipse,然后选择propper build tool version

  

Android 5.0.1 api 21

并添加了我的所有参考库,清理了所有项目并完成了所有工作。

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

希望这有助于!!!!

顺便说一下,我试图投票,但我没有足够的代表去做。

答案 22 :(得分:1)

当您转到Resource for android并选择sdk manager时,

Android 5.0将成为一个选项。下载并安装它。这将解决未找到资源的问题。