XML problem in the basic menu example

Posted by arakn0 on Stack Overflow See other posts from Stack Overflow or by arakn0
Published on 2010-06-02T22:07:33Z Indexed on 2010/06/02 22:24 UTC
Read the original article Hit count: 337

Filed under:
|
|
|

Hi there,

I am trying to create an app with some menus, an I am following the basic example available in the official android site:

http://developer.android.com/guide/topics/ui/menus.html

My problems appear when I define the menu in the XML. After creating the folder res/menu and creating the menu_option.xml file from eclipse.... The project (in general) gives an error that can be read from the Problems tab:

 
Unparsed aapt error(s)! Check the console for output
Android Packaging Problem

So, changing to the Console tab to get more information about the problem, this can be read:

 
[2010-06-02 11:35:54 - TestAudio] Error in an XML file: aborting build.
[2010-06-02 11:35:54 - TestAudio] W/ResourceType(11566): Bad XML block: header size 63327 or total size -144759824 is larger than data size 0
[2010-06-02 11:35:54 - TestAudio] /home/User/workspace/TestAudio/res/menu/options_menu.xml:1: error: Error parsing XML: no element found

The strange thing is that eclipse recognizes the menu items that I've defined in the XML,I can reference them in the code with no problems and my main activity builds. (and the rest of the files too).

Could it be that when eclipse creates a file, for some reason, the Android SDK has problems to read it, or something similar??

The XML code is exactly the same as the one in the example, so I don't really know what is happening. The code in options_menu.xml is this:

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/new_game"
          android:title="New Game" />
    <item android:id="@+id/quit"
          android:title="Quit" />
</menu>

Thanks in advance for your help!

© Stack Overflow or respective owner

Related posts about Xml

Related posts about android