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.
When I press 'run', the SDK is building a file main.out.xml and then fails as this:
[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
I had the same problem and tried alot of different things. Finally I gave up, copied the entire project tree to another location. Created a new Android project and copied the src files, res.layout, res.values files and my added custom images under drawable. Right clicked the project in package explorer and hit "Refresh". Now it works again. Probably not the best way to fix it but it works :-)
I believe I have the answer. I too was able to run with just any ol' file selected. Something changed and suddenly I was getting the dreaded xxx.out.xml parse error. Well, I found a way around it. Someone please confirm for me that this works for you too.
Click Window->Preferences Select or filter search for Launching(run/debug)
In the bottom of the right hand pane, look for Lauch Operation and select "Always launch the previously launched application"
Clean your project and run it correctly at least once. I tested this out and it seems to work consistently.
Cheers
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.
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.
Then, sit back and wait for the emulator to load for the first time (mine took about 1 to 2 minutes on a Macbook).
Yeah, same problem with me.
To prevent out.xml from being created.
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
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
As stated in How to stop Eclipse from trying to run XML files?: Under Preferences -> Run/Debug -> Launching, you can select "Always launch the previously launched application". This is useful if you tend to use the Ctrl+F11 shortcut.
Eclipse ->Project->Clean...restart your project ,and that's ok