Wednesday, February 16, 2011

Unparsed aapt error, main.out.xml

click Run button in Eclipse when I am working in a resource file such as main.xml.
I got error running the project.
a blank xml file "main.out.xml" showed up in editor with message "The document is empty".
In console, "No embedded stylesheet instruction for file".










Run again, got another errors
[2011-02-11 11:41:02 - xmlvsjson] Error in an XML file: aborting build.
[2011-02-11 11:41:02 - xmlvsjson] res/layout/main.xml:0: error: Resource entry main is already defined.
[2011-02-11 11:41:02 - xmlvsjson] res/layout/main.out.xml:0: Originally defined here.
[2011-02-11 11:41:02 - xmlvsjson] /Users/administrator/Documents/JAVA_opensource/AndroidOpenSource/xmlvsjson/XMLvsJSON/res/layout/main.out.xml:1: error: Error parsing XML: no element found

Under the "Problems" tab, I found this error "Unparsed aapt error(s)! Check the console for ..."



After search in the Internet, I found it's a bug of the ADT for eclipse. If currently editing xml file, Eclipse is trying to build the xml file with style sheet, which is unwanted.

To Fix This Problem:
1. Delete main.out.xml
2. Delete the Errors in "Problems"
3. run the project as android application

To Ensure the problem not happen again:
Preference -> Run/Debug ->Launching -> Launch Operation
Check "Always launch the previously launched application"

6 comments: