java Android,“XML 文件中的错误:中止构建。”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9957988/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 23:03:27  来源:igfitidea点击:

Android, "Error in an XML file: aborting build."

javaandroiddebuggingandroid-layout

提问by maximus

I am coding an Android project and get the error:

我正在编写一个 Android 项目并收到错误消息:

Error in an XML file: aborting build.

This is the XML code referenced in the error:

这是错误中引用的 XML 代码:

<?xml version="1.0" encoding="utf-8"?>
  <resources>
   <string name="app_name">Sudoku</string>
   <string name="main_title">Android Sudoku</string>
   <string name="continue_label">Continue</string>
   <string name="new_game_label">New Game</string>
   <string name="about_label">About</string>
   <string name="exit_label">Exit</string>
</resources>

What does this error mean and how can I find out where the error is?

这个错误是什么意思,我怎样才能找出错误在哪里?

采纳答案by 1owk3y

Tried Gabriels answer with no success. I ended up saving my strings.xml file elsewhere, deleting the one in the project, opening the AndroidManifest.xml (this was key), restarting Eclipse, and adding the file back worked like a charm.

尝试过 Gabriels 的回答但没有成功。我最终将我的 strings.xml 文件保存在其他地方,删除了项目中的文件,打开 AndroidManifest.xml (这是关键),重新启动 Eclipse,然后重新添加该文件就像一个魅力。

回答by Gabriel

This error occurs when you try to run the application with the xml file open.

当您尝试在 xml 文件打开的情况下运行应用程序时,会发生此错误。

Close all xml files, open the .java file and try to run the application again.

关闭所有 xml 文件,打开 .java 文件并尝试再次运行应用程序。

Don't forget to delete the ".out.xml" file.

不要忘记删除“.out.xml”文件。