Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
653 views
in Technique[技术] by (71.8m points)

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

I've always programmed Android with Eclipse and decided to start migrating to Android Studio .

(我一直使用Eclipse对Android进行编程,并决定开始迁移到Android Studio 。)

I decided to use the same SDK I already had for Eclipse, then:

(我决定使用与Eclipse相同的SDK,然后:)

  • Started a new project

    (开始一个新项目)

  • Set minimum SDK 4.0 (API Level 14)

    (设置最低SDK 4.0(API级别14))

  • Choose Blank Activity option

    (选择空白活动选项)

  • Used Default names for Activity Name and Layout Name

    (活动名称和布局名称使用的默认名称)

  • Hit Finish

    (击中完成)

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:

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

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

(错误:(2)检索项目的父项时出错:未找到与给定名称'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'.

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

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

(在文件->项目结构->模块:应用程序(左列)->属性标签下 ,我设置了以下版本:)

  • "Compile Sdk Version": Android 5.1 (API Level 22)

    (“编译SDK版本”:Android 5.1(API级别22))

  • "Build Tools Version": 23.0.2

    (“构建工具版本”:23.0.2)

What should I do in order to fix this?

(为了解决这个问题我该怎么办?)

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.

(我已经尝试过在堆栈溢出问题appcompat-v7:21.0.0'中建议的内容:没有找到与给定名称匹配的资源:attr'android:actionModeShareDrawable' ,但是没有用。)

  ask by Vini.g.fer translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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

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

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

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...