找不到与给定名称' Theme.AppCompat.Light.DarkActionBar'匹配的资源.
我已将 android-support-v7-appcompat
和 appcompat_v7
添加到项目浏览器.还将 android-support-v7-appcompat.jar
添加到了构建路径.
I have added android-support-v7-appcompat
and appcompat_v7
to the project explorer. And also added the android-support-v7-appcompat.jar
to the build path.
但是我又得到了
No resource found - Theme.AppCompat.Light.DarkActionBar!
该如何解决?
对我来说,该解决方案涉及重新创建Android的v7应用程序兼容性(appcompat)支持库:
For me the solution involved recreating Android's v7 application compatibility (appcompat) support library:
- 根据android-support-v7-appcompat 库Android开发者支持库设置页面上的="nofollow noreferrer">说明. 注意: 我必须手动更改
project.properties
文件,以编译新库.将target = android-19
更改为target = android-21
. - 将这个新的
android-support-v7-appcompat
库明确添加到遇到问题的项目中: - 完成后,项目的属性应如下所示:
- Create the new
android-support-v7-appcompat
library according to the instructions on the Android developer Support Library Setup page. Note: I had to manually change theproject.properties
file to get the new library to compile. Changetarget=android-19
totarget=android-21
. - Explicitly add this new
android-support-v7-appcompat
library to your troubled project: - After that's done the project's properties should look something like this:
现在,应编译项目.这是一个很长的路要走,但是对我有用.
Now, the project should compile. It's a long way to go, but it worked for me.
所有这些工作的一个有趣的副作用是,当我创建下一个项目时,Eclipse自动创建了一个新的 appcompat_v7
库项目,并将其添加到我的工作区中,突然一切恢复正常.我可能做了一些不同的事情,但是我还无法弄清楚是什么.无论如何,我最终使我的项目得以编译,并且在此过程中,似乎在Eclipse ADT中重置了某些内容.
An interesting side effect of all of this work is that when I created my next project, Eclipse automatically created a new appcompat_v7
library 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.
我希望这会有所帮助.