Simon Wong
Simon Wong

Reputation: 41

Error in an XML file reported and aborting build

When i edited the res/layout/main.xml and tried to re-run the application build. the following error message appears:

[2011-05-28 08:56:04 - MyWebApps1] res\layout\main.xml:0: error: Resource entry main is already defined.
[2011-05-28 08:56:04 - MyWebApps1] res\layout\main.out.xml:0: Originally defined here.
[2011-05-28 08:56:04 - MyWebApps1] C:\Users\Toshiba\Documents\android\MyWebApps1\res\layout\main.out.xml:1: error: Error parsing XML: no element found
[2011-05-28 08:56:07 - MyWebApps1] Error in an XML file: aborting build.

the main.xml file was edited correctly. No syntax error. Anyone has idea?

Upvotes: 4

Views: 11989

Answers (4)

Christopher
Christopher

Reputation: 71

Stop deleting your .out.xml!

While it's true that will "fix" your issue it will cause other issues, especially if you're designing and working on the UI with the 'graphical layout' tab in Eclipse. What's happening is that you're run configuration is messed up, you go to run it but it's trying to run .out.xml so it fails. The solution is not to start deleting files.

Click to the right of your green circle "run" button to bring down the options list and select "Run Configurations." Configure one for an emulated Android device. When you run the code use this custom configured run. Also, run from your main java file.

Upvotes: 2

Houcine
Houcine

Reputation: 24181

You need to delete the main.out.xml in your res/layout/ , and then clean your project.
If you work on Eclipse IDE , do like this : Project ==> Clean ==> check your project , and press OK.

Upvotes: 4

GospelGeek
GospelGeek

Reputation: 21

You must open "MainActivity.java" file, and try run again

Upvotes: 2

Franco
Franco

Reputation: 905

You pressed F11 to run the app but while being on the main.xml and due to your Eclipse configuration it ran the xml file, generating the .out.xml. Just delete it.

Upvotes: 6

Related Questions