开发者

Eclipse crashes on creating a new "menu" folder under "/res" for android development

开发者 https://www.devze.com 2023-02-10 11:57 出处:网络
I have an old computer: Pentium D 2.8 Ghz, 4 gig ram, win7 ult., running eclipse Helios and jdk1.6. I recently started learning android development and was going through some exercises people posted o

I have an old computer: Pentium D 2.8 Ghz, 4 gig ram, win7 ult., running eclipse Helios and jdk1.6. I recently started learning android development and was going through some exercises people posted on the web. During one exercise which basically creates an option menu, it asked to create a menu folder under /res and a xml file to define the menu elements. In eclipse, I right click on the res folder to choose to create a new folder --> that's fine but you can hear my computer fan picks up, then I create a black file and name it "menu.xml" and double click to open it, my computer processor pick up to max by javaw.exe and eclipse stops responding (indicated by windows). If you watch the javaw.exe in the task manager, the amount of memory it uses just keeps adding up (up to 1gig, i then killed the process manually).

I did the same thing but this time, rather than create the menu folder, i just created the menu.xml file under "layout" folder and everything is fine. So is this a bug in android / eclipse? This is not a on开发者_运维问答e time occurrence, it happens every time when i repeat the steps above -- including after rebooting the computer and start fresh.

Any ideas?


I can recreate this problem on latest Eclipse on Linux. I'm pretty sure it's a bug in the ADT that tries to validate an empty XML menu resource and gets stuck in an infinite loop, eventually causing a StackOverflow. It doesn't seem to happen for any other folder in res, so it must be related to menu inflation. You may want to submit this to Eclipse or AOSP.

Either way, the ADT plugin provides a wizard for creating XML files, use that. On the toolbar, it's the icon with an 'a' in it and a + in the upper right corner. Or you can use File > New > Other > Android > Android XML File, and create a Menu resource.

Update: after some googling, I found this thread on the android-developer mailing list. Apparently it's a known issue, and you should use the Android XML Resource wizard as described above.


I've got a P4 2.4GHz, 1GB ram, XP SP3 running Helios and jdk 1.6.1 and just created a new folder called /menu under /res with no problem at all. Therefore it doesn't seem to be a bug with android/eclipse unless it's win7 related.

Normally I would actually do what you want to do by right-clicking the project, selecting 'New' then 'Android XML File', select the Menu radio-button option, set the name to main.xml. Eclipse will default the location to /res/menu and create that subfolder if it doesn't already exist. Try that.


This happens to me as well. New "menu" folder in res, new menu.xml in that folder. try to open it, kaboom!

OSX 10.6.7, Eclipse Indigo, Android ADT, JDK 1.6

0

精彩评论

暂无评论...
验证码 换一张
取 消