tags:

views:

58

answers:

2

Hi folks, I just started working with Android apps and was trying few sample programs. I noticed an issue with the main.xml file. It happened twice today, I added few new layout views in main.xml (Using Layout and XML both), as soon as I made a modification and tried running the program, the R.java class would throw an error, also a new file called main.out.xml is getting created automatically. On top of this, when I am trying to "clean" the project, it deletes the R.java file altogether. Why is it acting this way?

A: 

Try deleting that tmp file and re-cleaning the project

PSU_Kardi
@PSU_Kardi, Thank you so very much :)
t3ch
What exactly causes this problem?
t3ch
Well it did remove the error notification, but now as soon as I try to run the program, its creating the same main.out.xml and then program fails saying Error parsing XML: no element found
t3ch
+3  A: 

This is a bug in the eclipse IDE relating to android development. I had the same problem when I first started. You need to make sure that the file that is currently being edited (i.e. active in the editor) is a java source file when you try to run the project. If any other file is active, such as your main.xml file then it ends up creating this main.out.xml that is a garbage file. To fix, just delete the garbage main.out.xml and make sure a java file is active and hit run and you are back to normal.

metalideath
@metalideath, Thanks. Perfect solution. Worked liked a charm. There is no permanent fix for this? Are there any other traps I need to watch out for?
t3ch
Thats the only really goofy thing that I have noticed. I have been unable to find a solution other then this work around.
metalideath
Cool.. Thanks for the help :)
t3ch