使用ActionBarSherlock当R无法得到解决的错误 [英] R cannot be resolved error when using ActionBarSherlock
问题描述
我想用杰克沃顿商学院的 ActionBarSherlock 支持android的项目,其他动作一路下跌至1.6
I am trying to use Jake Wharton's ActionBarSherlock to support actionbars in android projects all the way down to 1.6
我开始使用设在的影片HTTP ://actionbarsherlock.com/faq.html>常见问题页面,但在视频2:25后,当他进口的项目,我得到的> 200编译器错误,整个巨大的名单,主要是处理一些@覆盖材料。我最修复这些错误是:
I'm getting started using the video provided on the faq's page but after 2:25 in the video, when he imports the project, I get a whole huge list of >200 compilers errors, mostly dealing with some @override stuff. I fix most of those errors by:
右键单击项目>属性> Java编译器>编译器合规水平:和我将它设置为1.6
Right click on the project>properties>Java Compiler>compiler compliance level: and I set it to 1.6.
这将强制重新构建,突然我下降到只有54错误。他们大多是R不能解析为一个变量,但在过去5都进口com.actionbarsherlock.R不能得到解决。我搜索周围,解决这一共同的方式制定出如下:
This forces a re-build and suddenly I am down to just 54 errors. Most of them are "R cannot be resolved to a variable" but the last 5 are all "the import com.actionbarsherlock.R cannot be resolved". I have searched around and the common ways of solving this worked out as follows:
的请确保您的资源不在误差的 - 我查过,也没有问题,在/ res文件夹什么
"Make sure your resources are not in error" -- I checked and there are no problems with anything in the /res folder
的请确保您不会导入android.R 的 - 我不是。我有:
"Make sure you aren't importing android.R" -- I am not. I have:
import com.actionbarsherlock.R
这发生在我的包名可能是不正确的,但事实并非如此。
It occurred to me that the package name might be incorrect, but it isn't.
的只需清理项目的 - 这样做了很多次,没有效果
"Simply clean the project" -- Have done this many times to no effect
确保日食是能够产生R个文件在所有的 - 它可以在空白试验项目,我刚才
"Make sure eclipse is able to generate R files at all" -- It can in the blank test project I made just now
和一些其他修复这是更具体的ActionBarSherlock:
And some other fixes which are more specific to ActionBarSherlock:
的请确保您的targetSDK为11或更高的 - 这是设置为13
"Make sure your targetSDK is 11 or higher" -- It is set to 13
确保该项目是一个库项目的 - 这是
如何才能摆脱这些错误的?
How can I get rid of these errors?
推荐答案
找到了!
相反的:
项目>清洁>清洁工程选用以下
Project > Clean > Clean Projects Selected Below
您必须使用
项目>清除>清除所有项目
Project > Clean > Clean All Projects
即使没有其他的项目有什么与库项目。这解决了这一问题。
Even if none of the other projects have anything to do with the library project. This fixed the problem
这篇关于使用ActionBarSherlock当R无法得到解决的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!