Android 应用程序开发错误:“错误的 XML 块:标头大小 60 或总大小 3932356 大于数据大小 0”

发布于 2024-12-24 04:06:05 字数 527 浏览 2 评论 0原文

我检查了其他类似的帖子,他们建议清理构建路径, 但这根本没有帮助。
我已经开始 Android 应用程序开发,并且在向活动添加菜单时遇到了令人沮丧的问题。

<?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>

这会在 Eclipse 控制台中抛出“错误的 XML 块:标头大小 60 或总大小 3932356 大于数据大小 0”。 我有一个主要应用程序活动的菜单,它工作正常,但这个不能 合并到 R 生成的文件中。

我重写了一堆页面,现在似乎可以工作了,所以我要么错过了最初的一些东西,要么 Eclipse 决定重新评估该文件。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

等风也等你 2024-12-31 04:06:05

我刚刚遇到了同样的错误消息。就我而言,XML 引用了可绘制文件夹中缺少的图标文件。

您是否有可能在发生错误时没有 string/save_tea_label ?

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?

你不是我要的菜∠ 2024-12-31 04:06:05

项目->清洁应该处理这个问题。

编辑:如果干净的构建没有帮助,您可以尝试用以下内容替换有问题的XML文件(创建一个新文件):

<?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>

我唯一能做的我想到的是一个奇怪的角色以某种方式进入那里(复制/粘贴?)。

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?).

做个少女永远怀春 2024-12-31 04:06:05

确保您没有使用任何不适用于您正在开发的 API 级别的 API。
详情请参阅这篇文章; 示例代码“蓝牙聊天”中出现错误

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”

榆西 2024-12-31 04:06:05

对我来说,我尝试将 @drawable/add.png 添加到菜单项的图标属性中,然后才意识到它是声明性文字而不是该死的路径。

只需删除 .png 我的问题就解决了 q:)

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:)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文