Wednesday, March 10, 2010

Android: main.out.xml error


So it's been long time, I'm not doing Ruby anymore.
Now, for myself, I decided to create an Android application. At first, I wanted to create an Iphone application, but only people having a Mac can use the SDK... So let's use the Android SDK!
After doing the tutorial Hello World (see here), I started doing my application. And after a few minutes I had an error...

[2010-03-09 11:32:04 - shiro]Error in an XML file: aborting build.
[2010-03-09 11:32:05 - shiro]res\layout\main.xml:0: error: Resource entry main is already defined.
[2010-03-09 11:32:05 - shiro]res\layout\main.out.xml:0: Originally defined here.
[2010-03-09 11:32:05 - shiro]D:\workspace\shiro\res\layout\main.out.xml:1: error: Error parsing XML: no element found

For information, I'm using Eclipse. Why when I click on "run" I have this error ? Why Eclipse is creating a new file "main.out.xml" and then complain about it ? My application is really small, I didn't write any line of code in my main activity...

Well the error is simple, and it's not related to the application directly. It's a problem with Eclipse. To run the application, I must select the project (root folder) in the left column and then I can click on "run".

I had this error, because I was running the "main.xml". So Eclipse could not do anything with that.
Here is a noobie error, but it was difficult to find the solution...
I guess the next post will also concern Android application. It's always fun to discover new things :)

2 comments:

Jack said...

ye but its still a bug. pretty amazing this survived beta.

forums i read said you need to:

1) delete the main.out.xml file
2) close all layout files
3) select a .java file or the project node and then try to run

nup. Still didn't work. I finally found out, purely by accident, that you also need to delet the compoile error that appears under the problems tab.

sooo an error message itself prevents a build. go figure

Fernando Estrada said...

really good, very useful.