Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android sdk main.out.xml parsing error

Tags:

android

I just started a new Android project, helloword" to continue learning Android development and I got stumped compiling the default 'helloword' 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 as', i can not find android2.1 simulator.and find these errors:

[2012-07-25 08:59:49 - helloword] res\layout\activity_main.xml:0: error: Resource entry activity_main is already defined.
[2012-07-25 08:59:49 - helloword] res\layout\activity_main.out.xml:0: Originally defined here.
[2012-07-25 08:59:49 - helloword] E:\android软件开发\新建文件夹\helloword\res\layout\activity_main.out.xml:1: error: Error parsing XML: no element found
[2012-07-25 10:03:12 - helloword] /helloword/gen already exists but is not a source folder. Convert to a source folder or rename it.
[2012-07-25 10:03:13 - helloword] /helloword/gen already exists but is not a source folder. Convert to a source folder or rename it.
[2012-07-25 10:03:15 - helloword] File is Out of sync
[2012-07-25 10:05:13 - helloword] /helloword/gen already exists but is not a source folder. Convert to a source folder or rename it.
[2012-07-25 10:08:44 - helloword] activity_main.out.xml is out of sync. Please refresh.
[2012-07-25 10:08:45 - helloword] activity_main.out.xml is out of sync. Please refresh.
like image 403
willam.wallace Avatar asked Jul 25 '12 02:07

willam.wallace


2 Answers

It is not your fault. When you try to compile a android project from its xml resource , eclipse considers it as executing xml file and so you get some output from it, in the same name of the xml with .out.xml extension.

To avoid this, you have to right click the project and select run as -> Android Application for the first time and then follow the below steps,

Window -> Preferences -> Run/Debug -> Launching -> Launch Operation -> Always Launch the previously launched application

Once you provide this in the window->preferences, from the next time when you press "run" or "ctrl+f11" from even a xml file, your project will get executed.

EDIT: You must also delete res/layout/*.out.xml, the file that Eclipse created and you do not need it.

like image 169
Andro Selva Avatar answered Nov 18 '22 23:11

Andro Selva


Had the same problem, this fixed it for me.

  1. Delete activity_main.out.xml
  2. Double click on a .java file
  3. Hit F11
like image 30
amandawulf Avatar answered Nov 18 '22 22:11

amandawulf