尝试添加 menu.xml 时 Eclipse 挂起

发布于 2024-10-31 02:42:28 字数 282 浏览 5 评论 0原文

我最近开始使用 android sdk 进行开发。目前,我正在尝试添加代码来使用菜单,但是,当我尝试在 res/menu 下添加 menu.xml 时,Eclipse 每次都会挂起并冻结。当我重新打开 Eclipse 时,menu.xml 就在那里,但每次我尝试打开它时,Eclipse 都会再次挂起并冻结。 我正在 OS X Snow Leopard、Eclipse 3.6.2 和最新的 android sdk 和 adt 插件上运行。

有什么帮助、见解、想法吗?我彻底陷入困境了。

谢谢。

达斯汀

I've recently starting developing with the android sdk. Currently, I am trying to add code to use a menu, however, when I try to add a menu.xml under res/menu, Eclipse hangs and freezes every time. When I reopen the Eclipse, menu.xml is there, but every time I try to open it, Eclipse hangs and freezes again.
I am running on OS X Snow Leopard, Eclipse 3.6.2 and the latest android sdk and adt plugin.

Any help, insight, thoughts?? I am thoroughly stuck.

Thanks.

Dustin

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

花落人断肠 2024-11-07 02:42:28

感谢大家的意见。最终对我有用的是,我没有尝试手动创建新的 menu.xml 文件,而是找到了添加 android .xml 向导,并使用它来允许我添加我需要的任何内容,而不会出现任何挂断。

Thanks for the input guys. What ended up working for me was instead of trying to manually create a new menu.xml file, I find the add android .xml wizard and using it instead allowed me to add whatever I needed with out any hang ups.

娇纵 2024-11-07 02:42:28

即使在最新版本的 Eclipse (Helios) 下,我也会遇到同样的问题。如果我等待足够长的时间,Eclipse 会报告堆栈溢出异常,然后在“输出”窗口中显示:

W/ResourceType( 5124): Bad XML block: header size 0 or total size 9949440 is more than data size 0< /em>

menu.xml:1: error: Error parsing XML: no element find

这表明 XML 解析器没有处理空文档,并且 Android 菜单编辑器在新创建的文件上出现错误。试图打开它。我确信有一些“标准”方法可以创建不会破坏 IDE 的新菜单,但我不知道该方法是什么。我太习惯手动编辑文件了,但是这个崩溃/挂起错误是一个严重的麻烦。

Same problem happens for me even under the latest version of Eclipse (Helios). If I wait long enough, Eclipse reports a stack overflow exception and then this shows up in the Output window:

W/ResourceType( 5124): Bad XML block: header size 0 or total size 9949440 is larger than data size 0

menu.xml:1: error: Error parsing XML: no element found

This indicates that the XML parser isn't handling empty documents and the Android menu editor is barfing on the newly created file while trying to open it. I'm sure there is some "standard" way of creating a new menu that doesn't break the IDE but I have no idea what that method is. I'm too used to editing my files by hand but this crash/hang bug is a serious nuisance.

紫轩蝶泪 2024-11-07 02:42:28

达斯汀,

我认为发生的情况是,你的设置已损坏。我强烈建议您重置所有设置。请记住,您将必须重新导入所有项目,因此这可能会很痛苦,但我真的认为这会解决您的问题。

首先,找到您的工作区文件夹并将其重命名为“workspace-bad”之类的名称
然后,创建一个空的工作区文件夹来替换您刚刚重命名的文件夹。
最后,打开 eclipse,它将像全新安装一样运行。

您将需要重新导入您的项目,这可以通过转到 eclipse,点击 File>Import... 来完成。
然后在常规下选择
“将现有项目放入工作区”
然后点击“下一步”,然后点击“浏览”找到根目录
还要确保选中“将项目复制到工作区”,

我还建议首先执行“问题项目”,这样您就不会浪费时间做其余的事情,然后发现必须重新创建它。

我希望这能为您解决问题,祝您好运! :-)

-贾里德

Dustin,

I think what has happened is, your settings have become corrupt. I highly recommend resetting all your settings. Keep in mind, you will have to re-import all your projects so this can be quite a pain, but I really think this will fix your problem.

To start, find your workspace folder and rename it to something like "workspace-bad"
Then, create an empty workspace folder to replace the one you just renamed.
Lastly, open eclipse and it will act just like a brand-new installation.

You will need to re-import your projects, which can be done by going to eclipse, hitting File>Import...
Then select under General
"Existing Projects into Workspace"
then hit "Next" and then hit "Browse" to find the root directory
also make sure "Copy project into workspace" is checked

I also recommend doing your "problem project" first, that way you don't waste your time doing the rest and then find out you have to re-create it.

I'm hoping that fixes it for you, good luck! :-)

-Jared

能怎样 2024-11-07 02:42:28

我使用相同的设置遇到了同样的问题。右键单击 menu.xml,选择“打开方式”,然后选择 Xml 编辑器对我来说似乎是一个可行的解决方法。

I ran into the same issue with the same setup. Right clicking menu.xml, selecting 'Open With', and selecting Xml Editor seemed to be a viable workaround for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文