Android App development error: "Bad XML block: header size 60 or total size 3932356 is larger than data size 0"-ThrowExceptions

Exception or error:

I checked other posts that were similar and they recommended to clean the build path,
but that did not help at all.
I have started android app development and am having a frustrating problem with adding a menu to an activity.

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:id="@+id/save_tea" android:title="@string/save_tea_label" />
</menu>

This throws the “Bad XML block: header size 60 or total size 3932356 is larger than data size 0” in the Eclipse console.
I have a menu for the main app activity and it works fine, but this one cannot be
combined into the R generated file.

I rewrote a bunch of my pages and it seems to work now, so I either missed something originally or eclipse decided to reevaluate the file.

How to solve:

I just ran into the same error message. In my case, the XML was referencing a missing icon file in the drawables folder.

Is it possible you did not have string/save_tea_label at the time of the error?

###

A Project->Clean should take care of this.

Edit: If a clean build didn’t help, can you try replacing the XML file in question with the following contents (create a new file):

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
  <item
      android:id="@+id/save_tea"
      android:title="@string/save_tea_label" />
</menu>

The only thing I can think of is that a weird character got in there somehow (copy/paste?).

###

Make sure you are not using any APIs not available for the API level you are developing for.
See this post for details; Error in the sample code “bluetooth chat”

###

For me, I tried to add a @drawable/add.png to a menu item’s icon attribute before realising that it’s a declarative literal and not a bloody path.

Simply removing the .png and my problem was solved q:)

Leave a Reply

Your email address will not be published. Required fields are marked *