eclipse 告诉我我的项目有错误,没有什么是红色突出显示的
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3630873/
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
eclipse tells me my project has errors, nothing is red-highlighted
提问by Seth Nelson
This happened to two programs of mine now and makes absolutely no sense. It usually comes about when I'm adding a resource file (in this case, a menu). In the package explorer: -the project name has a small red x, indicating that there is an error in one of its files -none of the sub-folders or files have an x or show any red highlights
这发生在我的两个程序上,完全没有意义。它通常在我添加资源文件(在本例中为菜单)时出现。在包资源管理器中: - 项目名称有一个小的红色 x,表示它的一个文件中存在错误 - 没有子文件夹或文件有 x 或显示任何红色突出显示
None of my code has errors! Ocasionally, I see this:
我的代码都没有错误!偶尔,我看到这个:
[2010-09-02 16:09:20 - FallDown] 'default' is not a best match for any device/locale combination.
[2010-09-02 16:09:20 - FallDown] Displaying it with 'Normal, Not Long, Landscape, Medium Density, Finger, Soft, Qwerty, Trackball, 480x320'
What is going on?
到底是怎么回事?
采纳答案by Juri
Usually what I do in this case is to call "Project > Clean" from the menu.
通常我在这种情况下所做的是从菜单中调用“项目 > 清理”。
With this Project > Clean we should also check our layout (xml) it might be representing any components which is going out of screen size.
通过这个 Project > Clean,我们还应该检查我们的布局 (xml),它可能代表任何超出屏幕尺寸的组件。
回答by antonyt
Window --> Show View --> Problems
. This should display a list of the specific problems that Eclipse is 'worried' about.
Window --> Show View --> Problems
. 这应该显示 Eclipse 所“担心”的特定问题的列表。
回答by Jeff Curren
Eclipse is trying to debug or run the resource xml file you have in focus. That's why it happens after you have added or edited a resource file.
Eclipse 正在尝试调试或运行您关注的资源 xml 文件。这就是在您添加或编辑资源文件后会发生这种情况的原因。
To avoid the issue, make sure you debug or run your project, not the xml file.
为避免此问题,请确保您调试或运行您的项目,而不是 xml 文件。
Either select the project before you click the debug/run icon or use the debug or run dropdown and select run [your project name].
在单击调试/运行图标之前选择项目,或者使用调试或运行下拉菜单并选择运行 [您的项目名称]。
回答by monn3t
This could help.
这可能会有所帮助。
I had two xml layout files set up for various configurations (various layout folders according to the MMC phone operator/country where that carrier operates.
我为各种配置设置了两个 xml 布局文件(根据 MMC 电话运营商/运营商所在国家/地区的不同布局文件夹。
I noticed, that the message only was presented when I opened those files. The rest of my xml's worked fine.
我注意到,只有当我打开这些文件时才会显示该消息。我的 xml 的其余部分工作正常。
I am sure that it had something to do with how I did my folder configuration (not properly set by me) in the res directory.
我确信这与我在 res 目录中进行文件夹配置(我没有正确设置)的方式有关。
Long story short (and I'm not saying this will fit your case) I deleted those additional configurations and it never happened again.
长话短说(我并不是说这适合你的情况)我删除了那些额外的配置,它再也没有发生过。
From what I can gather, the system couldn't deal with all those folders / configurations, so it tried to present the default one (which is what ever you have in the layout folder, and since, is trying to make it work with any device (and it can't) gives the warning and sets a configuration that understands is the one that will fit most devices.
据我所知,系统无法处理所有这些文件夹/配置,因此它尝试呈现默认的(这是您在布局文件夹中拥有的所有内容,并且因为,试图使其与任何设备(它不能)发出警告并设置一个配置,该配置了解适合大多数设备的配置。
Thing is that in my case I am dealing with phones and tablets, high and low resolutions and in some of them that setting presented an awful screen.
事情是,在我的情况下,我正在处理手机和平板电脑,高分辨率和低分辨率,其中一些设置呈现出糟糕的屏幕。
Here is my res folder configuration:
这是我的 res 文件夹配置:
res drawable layout layout-mcc310 layout-mcc310-land layout-mcc311 layout-mcc311-land layout-mcc316 layout-mcc316-landvalues values-es
res drawable layout layout-mcc310 layout-mcc310-land layout-mcc311 layout-mcc311-land layout-mcc316 layout-mcc316-landvalues values-es
The ones in bold were the ones with a slightly modified copy of the 2 xml file previously mentioned.
粗体部分是对前面提到的 2 xml 文件稍加修改的副本。
I deleted those and in my case the problem was fixed.
我删除了这些,就我而言,问题已解决。
Cheers!
干杯!
monn3t
monn3t