Eclipse hangs when trying to add menu.xml

断了今生、忘了曾经 提交于 2019-12-11 06:53:04

问题


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


回答1:


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.




回答2:


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.




回答3:


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




回答4:


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.



来源:https://stackoverflow.com/questions/5588086/eclipse-hangs-when-trying-to-add-menu-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!