检索项目的父项时出错:升级到 AppCompat v23 后找不到与给定名称匹配的资源 [英] Error retrieving parent for item: No resource found that matches the given name after upgrading to AppCompat v23

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

问题描述

我一直使用 Eclipse 对 Android 进行编程,并决定开始迁移到 Android Studio.我决定使用与 Eclipse 相同的 SDK,然后:

I've always programmed Android with Eclipse and decided to start migrating to Android Studio. I decided to use the same SDK I already had for Eclipse, then:

  • 开始了一个新项目
  • 设置最低 SDK 4.0(API 级别 14)
  • 选择空白活动选项
  • 活动名称和布局名称使用的默认名称
  • 点击完成

几秒钟后,Gradle 完成构建,它在文件 Teste4\app\build\intermediates/exploded-aar\com.android.support\appcompat-v7\23.0.0\ 中抛出了两个错误和以下消息res\values-v23\values-v23.xml:

After a few seconds Gradle finishes the build, and it throws me two errors with the following messages in file Teste4\app\build\intermediates/exploded-aar\com.android.support\appcompat-v7\23.0.0\res\values-v23\values-v23.xml:

错误:(2) 检索项目的父项时出错:找不到与给定名称android:TextAppearance.Material.Widget.Button.Inverse"匹配的资源.

错误:(2) 检索项目的父项时出错:找不到与给定名称android:Widget.Material.Button.Colored"匹配的资源.

Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.

Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

File -> Project Structure -> Modules: app (left column) -> Properties tab 下,我设置了以下版本:

Under File -> Project Structure -> Modules: app (left column) -> Properties tab, I have the following versions set up:

  • 编译 Sdk 版本":Android 5.1(API 级别 22)
  • 构建工具版本":23.0.2

我应该怎么做才能解决这个问题?

What should I do in order to fix this?

我已经尝试过 Stack Overflow 问题中的建议 appcompat-v7:21.0.0': No resource found that match the givenname: attr 'android:actionModeShareDrawable',但是没有用.

I already tried what was suggested in Stack Overflow question appcompat-v7:21.0.0': No resource found that matches the given name: attr 'android:actionModeShareDrawable', but it didn't work.

推荐答案

您的编译 SDK 版本必须与支持库的主要版本匹配.

Your compile SDK version must match the support library's major version.

由于您使用的是版本 23 的支持库,您需要针对版本 23 的 Android SDK 进行编译.

Since you are using version 23 of the support library, you need to compile against version 23 of the Android SDK.

或者,您可以切换到最新的支持库 v22,继续针对 Android SDK 22 版进行编译.

Alternatively you can continue compiling against version 22 of the Android SDK by switching to the latest support library v22.

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

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