willam.wallace
willam.wallace

Reputation: 91

Android sdk main.out.xml parsing error

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.

Upvotes: 9

Views: 10197

Answers (3)

Andro Selva
Andro Selva

Reputation: 54322

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.

Upvotes: 27

amandawulf
amandawulf

Reputation: 683

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

Upvotes: 2

MBMJ
MBMJ

Reputation: 5431

Never run your project from xml file .Open your java code then run it...If you run it from xml you will get that error.Its also same for manifest file

Upvotes: 0

Related Questions