android sdk main.out.xml 解析错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2393103/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
android sdk main.out.xml parsing error?
提问by mobibob
I just started a new Android project, "WeekendStudy" to continue learning Android development and I got stumped compiling the default 'hello weekendstudy' compile / run. I think that I missed a step in configuration and setup, but I am at a loss to find out where. I have an AVD configured, set and launched.
我刚刚开始了一个新的 Android 项目“WeekendStudy”来继续学习 Android 开发,但我在编译默认的“hello周末学习”编译/运行时遇到了困难。我想我错过了配置和设置的一步,但我不知道在哪里。我有一个 AVD 配置、设置和启动。
When I press 'run', the SDK is building a file main.out.xml and then fails as this:
当我按“运行”时,SDK 正在构建文件 main.out.xml,然后失败,如下所示:
[2010-03-06 09:46:47 - WeekendStudy]Error in an XML file: aborting build.
[2010-03-06 09:46:48 - WeekendStudy]res/layout/main.xml:0: error: Resource entry main is already defined.
[2010-03-06 09:46:48 - WeekendStudy]res/layout/main.out.xml:0: Originally defined here.
[2010-03-06 09:46:48 - WeekendStudy]/Users/mobibob/Projects/workspace-weekend/WeekendStudy/res/layout/main.out.xml:1: error: Error parsing XML: no element found
[2010-03-06 09:48:16 - WeekendStudy]Error in an XML file: aborting build.
[2010-03-06 09:48:16 - WeekendStudy]res/layout/main.xml:0: error: Resource entry main is already defined.
[2010-03-06 09:48:16 - WeekendStudy]res/layout/main.out.xml:0: Originally defined here.
[2010-03-06 09:48:16 - WeekendStudy]/Users/mobibob/Projects/workspace-weekend/WeekendStudy/res/layout/main.out.xml:1: error: Error parsing XML: no element found
[2010-03-06 09:55:29 - WeekendStudy]res/layout/main.xml:0: error: Resource entry main is already defined.
[2010-03-06 09:55:29 - WeekendStudy]res/layout/main.out.xml:0: Originally defined here.
[2010-03-06 09:55:29 - WeekendStudy]/Users/mobibob/Projects/workspace-weekend/WeekendStudy/res/layout/main.out.xml:1: error: Error parsing XML: no element found
[2010-03-06 09:55:49 - WeekendStudy]Error in an XML file: aborting build.
[2010-03-06 09:55:49 - WeekendStudy]res/layout/main.xml:0: error: Resource entry main is already defined.
[2010-03-06 09:55:49 - WeekendStudy]res/layout/main.out.xml:0: Originally defined here.
[2010-03-06 09:55:49 - WeekendStudy]/Users/mobibob/Projects/workspace-weekend/WeekendStudy/res/layout/main.out.xml:1: error: Error parsing XML: no element found
回答by Hugo Garcia-Cotte
Better fixing: Eclipse -> Window -> Preferences -> Run/Debug -> Launching -> Lauch Configuration
更好的修复:Eclipse -> Window -> Preferences -> Run/Debug -> Launching -> Lauch Configuration
Cross : Filter checked launch configuration types and Cross also : XSL (at the end of the list)
Cross :过滤选中的启动配置类型和 Cross :XSL(在列表末尾)
Make the problem go away Forever !
让问题永远消失!
回答by Berry Wing
Yeah, same problem with me.
是的,和我一样的问题。
To prevent out.xml from being created.
防止创建 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
编辑一个 XML 文件,这是一件非常自然的事情......
保存并关闭 XML 文件
在 src/ 中打开任何 .java 文件
双击文件以确保它具有焦点并且光标在那里。
运行...现在应该可以了
If it happens, do this...
如果发生了,请这样做...
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
编辑一个 XML 文件,这是一件非常自然的事情......
运行...由于可怕的 out.xml 文件而崩溃
删除 /res/___.out.xml 文件
关闭 IDE 视图中的所有文件
项目...清洁...
在 src/ 中打开任何 .java 文件
双击文件使其具有焦点并且光标在那里。
运行...现在应该可以了
回答by wang
you should run the project as android application not only cilck the icon--Run
您应该将项目作为 android 应用程序运行,而不仅仅是点击图标--运行
回答by user383343
Deleted the xxx.out.xml, if still can't run, please follow this Eclipse ->Project->Clean...->Choose your project->OK
删除了xxx.out.xml,如果还是不能运行,请按照这个Eclipse ->Project->Clean...->Choose your project->OK
Set the cursor in your *.java, Run it
在 *.java 中设置光标,运行它
回答by mobibob
I was trying to run from the wrong part of the project since my toolbar was not hooked up correctly. I am still working out the details and I will edit this when I figure it out completely.
我试图从项目的错误部分运行,因为我的工具栏没有正确连接。我仍在研究细节,当我完全弄清楚时我会编辑它。
First of all, this was a new workspace that I wanted to create to organize my different unrelated projects. As a result, the RUN of the toolbar did not have a target configured (i.e., in the history), so it tried to run my main.xml file.
首先,这是一个新的工作空间,我想创建它来组织我不同的不相关项目。结果,工具栏的 RUN 没有配置目标(即在历史记录中),因此它尝试运行我的 main.xml 文件。
Right-click on one of the *.java files and select 'run as...' then you can create a run configuration with its target (pick or create an AVD), the project, etc. I recommend visiting each of the tabs and review the defaults for your situation.
右键单击 *.java 文件之一并选择“运行方式...”,然后您可以使用其目标(选择或创建 AVD)、项目等创建运行配置。我建议访问每个选项卡并根据您的情况查看默认值。
Then, sit back and wait for the emulator to load for the first time (mine took about 1 to 2 minutes on a Macbook).
然后,坐下来等待模拟器第一次加载(我在 Macbook 上花费了大约 1 到 2 分钟)。
回答by estitt
This appears to be an issue with one of eclipse's XML plugins, I think it is something in Web Tools. I used to be able to run the app from any file, be it XML or java, but once I installed Web Tools I started seeing this error. It really is annoying, I am so used to pressing Ctrl-F11 to build the app...but if you do that in an XML file you get this error. The fix mentioned above does work, but it is extra steps and less efficient to have to right-click the project and select Run As... blah blah. If anyone figures out a clean solution - besides removing Web Tools of course - to get me back my shortcut key I would be grateful.
这似乎是 eclipse 的 XML 插件之一的问题,我认为这是 Web Tools 中的问题。我曾经能够从任何文件运行应用程序,无论是 XML 还是 java,但是一旦我安装了 Web Tools,我就开始看到这个错误。这真的很烦人,我习惯于按 Ctrl-F11 来构建应用程序……但是如果您在 XML 文件中执行此操作,则会出现此错误。上面提到的修复确实有效,但是必须右键单击项目并选择运行方式...等等,这是额外的步骤并且效率较低。如果有人想出一个干净的解决方案——当然除了删除 Web 工具——让我找回我的快捷键,我将不胜感激。
回答by Anand
I am new in Android app development learning. I encountered this problem too and got frustrated. Uninstall whole Android SDK and reinstall, thinking in mind that there was some problem.
我是 Android 应用开发学习的新手。我也遇到了这个问题并且很沮丧。卸载整个Android SDK并重新安装,想到有一些问题。
To my surprise, solution is very simple. If you leave the mouse click over xml file and go to Run it will generate error. So the solution is simple. Click on .java file or Top of the whole tree (example: if the structure is like this: Firstapp>Src>Firstapp.java, just click on Firstapp) and then run.
令我惊讶的是,解决方案非常简单。如果您将鼠标悬停在 xml 文件上并转到“运行”,则会生成错误。所以解决方法很简单。点击.java文件或者Top of the entire tree(例如:如果结构是这样的:Firstapp>Src>Firstapp.java,直接点击Firstapp)然后运行。
It will run smoothly.
它会顺利运行。
回答by user366584
Do try, and check the valid source is running or not.
请尝试,并检查有效源是否正在运行。
Deleted the xxx.out.xml, if still can't run, please follow this Eclipse ->Project->Clean...->Choose your project->OK
删除了xxx.out.xml,如果还是不能运行,请按照这个Eclipse ->Project->Clean...->Choose your project->OK
回答by Jha
I was also facing this issue.
我也面临这个问题。
When using eclispe make sure before clicking "Run", Any file selected in Project is not the XML file.With this you will never get this error. Also, Make sure you have deleted all the ....out.xml from your workspace.
使用 eclispe 时,请确保在单击“运行”之前,在项目中选择的任何文件都不是 XML 文件。这样您将永远不会收到此错误。另外,请确保您已从工作区中删除所有 ....out.xml。
I spend almost 30 Min to know the root cause of this and found this solution.
我花了将近 30 分钟才知道这个问题的根本原因并找到了这个解决方案。
回答by Nguyen Minh Binh
I faced this problem but above answers do not help me. After look around, I fixed this by my self and I think I should write down the solution.
我遇到了这个问题,但以上答案对我没有帮助。环顾四周,我自己解决了这个问题,我想我应该写下解决方案。
The android compiler create *.out.xml if you run the project as XSL. to fix this, you should do these steps:
如果您将项目作为 XSL 运行,则 android 编译器会创建 *.out.xml。要解决此问题,您应该执行以下步骤:
- click on the arrow at right side of Run button, select Run Configurations. At the left side of popup windows, delete all sub-items under XSL.
- go to Launch configuration under preferences=>Run/debug =>Launching. Check to "Filter checked launch..." and then, uncheck XSL when keeping check on Android Application.
- 单击“运行”按钮右侧的箭头,选择“运行配置”。在弹出窗口的左侧,删除 XSL 下的所有子项。
- 转到首选项 => 运行/调试 => 启动下的启动配置。选中“过滤已检查的启动...”,然后在检查 Android 应用程序时取消选中 XSL。
Hope this helps.
希望这可以帮助。