eclipse编译android错误:res\layout\main.out.xml:0: error
今天运行一个android小程序,又莫名其妙的出现一个错误,错误信息如下:
[2010-12-22 20:37:17 - Study] Error in an XML file: aborting build.
[2010-12-22 20:37:18 - Study] res\layout\main.xml:0: error: Resource entry main is already defined.
[2010-12-22 20:37:18 - Study] res\layout\main.out.xml:0: Originally defined here.
[2010-12-22 20:37:18 - Study] G:\Android\Study\res\layout\main.out.xml:1: error: Error parsing XML: no element found
[2010-12-22 20:37:18 - Study] res\layout\main.xml:0: error: Resource entry main is already defined.
[2010-12-22 20:37:18 - Study] res\layout\main.out.xml:0: Originally defined here.
[2010-12-22 20:37:18 - Study] G:\Android\Study\res\layout\main.out.xml:1: error: Error parsing XML: no element found
[2010-12-22 20:39:06 - Study] Error in an XML file: aborting build.
[2010-12-22 20:39:26 - Study] res\layout\main.xml:0: error: Resource entry main is already defined.
[2010-12-22 20:39:26 - Study] res\layout\main.out.xml:0: Originally defined here.
[2010-12-22 20:39:26 - Study] G:\Android\Study\res\layout\main.out.xml:1: error: Error parsing XML: no element found
网上搜了下,遇到这样问题的还真不少,找了一篇老外的帖子,其中一个解决办法我试了下,解决问题。方法如下:
防止out.xml文件被创建的方法:
- edit an XML file, a perfectly natural thing to do….
- save and close the XML file
- Open any .java file in src/
- Double click in the file to ensure it has focus and the cursor is in there.
- Run… should be OK now
如果out.xml文件已经出来,即错误已经有了(我遇到的就是这问题),解决的办法:
- edit an XML file, a perfectly natural thing to do….
- Run… crash due to dreaded out.xml file
- Delete the /res/_.out.xml file
- Close all files in the IDE view
- Project…Clean…
- Open any .java file in src/
- Double click in the file so it has focus and the cursor is in there.
- Run… should be OK now
总结了下,其实只要到eclipse中project->clean(选择你出错的项目),然后重新运行你的项目即可。
转载请标明出处:萝卜根
原文地址请标明:原文地址