简体   繁体   English

Eclipse在“ / res”下为Android开发创建新的“ menu”文件夹时崩溃

[英]Eclipse crashes on creating a new “menu” folder under “/res” for android development

I have an old computer: Pentium D 2.8 Ghz, 4 gig ram, win7 ult., running eclipse Helios and jdk1.6. 我有一台旧计算机:Pentium D 2.8 Ghz,4 gig ram,win7 ult。,运行Eclipse Helios和jdk1.6。 I recently started learning android development and was going through some exercises people posted on the web. 我最近开始学习android开发,并正在网上进行一些练习。 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. 在一个基本上创建选项菜单的练习中,它要求在/ res下创建菜单文件夹,并创建一个xml文件来定义菜单元素。 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). 在eclipse中,我右键单击res文件夹以选择创建一个新文件夹->很好,但是您会听到计算机风扇启动的声音,然后创建一个黑色文件并将其命名为“ menu.xml”,然后双击以打开它,我的计算机处理器被javaw.exe调到最大,并且eclipse停止响应(由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). 如果您在任务管理器中看到javaw.exe,它使用的内存量将不断增加(最多1gig,然后我手动终止了该进程)。

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. 我做了同样的事情,但是这次,不是创建菜单文件夹,而是在“ layout”文件夹下创建了menu.xml文件,一切都很好。 So is this a bug in android / eclipse? 那么这是android / eclipse中的错误吗? This is not a one 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. 我可以在Linux上最新的Eclipse上重新创建此问题。 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. 我很确定这是ADT中的一个错误,该错误试图验证空的XML菜单资源并陷入无限循环,最终导致StackOverflow。 It doesn't seem to happen for any other folder in res, so it must be related to menu inflation. res中的任何其他文件夹似乎都没有发生这种情况,因此它必须与菜单膨胀有关。 You may want to submit this to Eclipse or AOSP. 您可能需要将此提交到Eclipse或AOSP。

Either way, the ADT plugin provides a wizard for creating XML files, use that. 无论哪种方式,ADT插件都提供了用于创建XML文件的向导。 On the toolbar, it's the icon with an 'a' in it and a + in the upper right corner. 在工具栏上,它是带有“ a”和右上角为+的图标。 Or you can use File > New > Other > Android > Android XML File, and create a Menu resource. 或者,您可以使用文件>新建>其他>安卓>安卓XML文件,然后创建菜单资源。

Update: after some googling, I found this thread on the android-developer mailing list. 更新:经过一番谷歌搜索后,我在android-developer邮件列表中找到了这个线程 Apparently it's a known issue, and you should use the Android XML Resource wizard as described above. 显然,这是一个已知问题,您应该使用如上所述的Android XML资源向导。

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. 我有一个运行Helios和jdk 1.6.1的P4 2.4GHz,1GB内存,XP SP3,并在/ res下创建了一个名为/ menu的新文件夹,完全没有问题。 Therefore it doesn't seem to be a bug with android/eclipse unless it's win7 related. 因此,除非它与win7有关,否则它似乎不是android / eclipse的错误。

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. 通常,我实际上将通过右键单击项目,选择“新建”,然后选择“ Android XML文件”,选择“菜单”单选按钮选项,将名称设置为main.xml来执行您想要的操作。 Eclipse will default the location to /res/menu and create that subfolder if it doesn't already exist. Eclipse将默认位置为/ res / menu并创建该子文件夹(如果尚不存在)。 Try that. 试试看

This happens to me as well. 这也发生在我身上。 New "menu" folder in res, new menu.xml in that folder. res中的新“菜单”文件夹,该文件夹中的新menu.xml。 try to open it, kaboom! 尝试打开它,kaboom!

OSX 10.6.7, Eclipse Indigo, Android ADT, JDK 1.6 OSX 10.6.7,Eclipse Indigo,Android ADT,JDK 1.6

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 创建新的Android项目时Eclipse崩溃 - Eclipse crashes when creating a new android project 如何将菜单文件夹添加到android studio项目的res文件夹中 - How to add a menu folder to the res folder of an android studio project 在 Eclipse 中创建一个包,相当于创建一个新文件夹吗? - Is creating a package in Eclipse, equivalent of creating a new folder? 无法在Android Studio中将版本Qualifier Folder添加到res / menu - Cant add version Qualifier Folder into res/menu in Android Studio 创建Android Project后Eclipse Juno崩溃 - Eclipse Juno crashes after creating Android Project 使用Eclipse创建新的android项目后,Eclipse中的SRC文件夹为空(未创建MainActivity类) - SRC folder in Eclipse is empty (MainActivity class not created) after creating a new android project using Eclipse 在Eclipse中创建新的Android模拟器? - Creating a new Android emulator in eclipse? 无法找到文件夹和res文件夹下的变量 - Cant find folder and variable under res folder 创建新的Mat变量会使android应用崩溃 - Creating new Mat variable crashes android app 创建新的android应用程序项目后,Eclipse给出了一个空的src和asset文件夹 - Eclipse gives an empty src and assets folder after creating a new android application project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM