eclipse 找不到与给定名称“Theme.AppCompat.Light.DarkActionBar”匹配的资源

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26729695/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 22:10:26  来源:igfitidea点击:

No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'

androideclipseandroid-appcompat

提问by Arun Kumar K S

I have added android-support-v7-appcompatand appcompat_v7to the project explorer. And also added the android-support-v7-appcompat.jarto the build path.

我已将android-support-v7-appcompat和添加appcompat_v7到项目资源管理器中。并且还添加android-support-v7-appcompat.jar到构建路径。

But again I'm getting this

但我再次得到这个

No resource found - Theme.AppCompat.Light.DarkActionBar!

Screenshot of eclipse package explorer

eclipse 包浏览器截图

How to fix this?

如何解决这个问题?

回答by Quantium

For me the solution involved recreating Android's v7 application compatibility (appcompat) support library:

对我来说,解决方案涉及重新创建 Android 的 v7 应用程序兼容性 (appcompat) 支持库:

  1. Create the new android-support-v7-appcompatlibrary according to the instructionson the Android developer Support Library Setup page. Note:I had to manually change theproject.propertiesfile to get the new library to compile. Changetarget=android-19totarget=android-21.
  2. Explicitly add this new android-support-v7-appcompatlibrary to your troubled project: Properties Dialog - Adding libraryProject Selection Dialog
  3. After that's done the project's properties should look something like this: Project Properties
  1. android-support-v7-appcompat根据Android 开发人员支持库设置页面上的说明创建新库。注意:我必须手动更改project.properties文件才能编译新库。更改target=android-19target=android-21
  2. 将这个新android-support-v7-appcompat库显式添加到您遇到问题的项目中: 属性对话框 - 添加库项目选择对话框
  3. 完成后,项目的属性应如下所示: 项目属性

Now, the project should compile. It's a long way to go, but it worked for me.

现在,项目应该可以编译了。这还有很长的路要走,但它对我有用。



An interesting side effect of all of this work is that when I created my next project, Eclipse automatically created a new appcompat_v7library project, added it to my workspace, and suddenly everything was back to normal. I probably did something different, but I just haven't been able to figure it out what yet. Anyway, I finally got my project to compile and in the process it appears that I reset something in the Eclipse ADT.

所有这些工作的一个有趣的副作用是,当我创建我的下一个项目时,Eclipse 会自动创建一个新的appcompat_v7库项目,并将其添加到我的工作区,突然一切都恢复正常。我可能做了一些不同的事情,但我还没有弄清楚是什么。无论如何,我终于编译了我的项目,在这个过程中,我似乎在 Eclipse ADT 中重置了一些东西。

I hope this helps.

我希望这有帮助。

回答by Krishna

please check whether the version of android you are targeting , do you have the SDK build tools and latest support package ??

请检查您所针对的 android 版本是否为目标,您是否拥有 SDK 构建工具和最新的支持包?

If not please go to

如果没有请去

Window>Android sdk manager>

窗口>Android sdk 管理器>

Click the packages for targeting the exact version and update the support if you are targeting the latest

单击针对确切版本的软件包,如果您针对的是最新版本,请更新支持

If none of the above worked then u may have deleted the older sdk build tools in sdk manager after update.Please re-install them and restart eclipse , everything works fine .

如果以上都不起作用,那么您可能在更新后删除了 sdk 管理器中旧的 sdk 构建工具。请重新安装它们并重新启动 eclipse,一切正常。