Errors possibly associated with R.java

可能与R.java文件错误

问题 (Question)

my android app development ran into the issue with the R.java file not appearing and causing a host of other errors. I believe that might be remedied or either will be after I fix these Console Errors:

[2014-05-03 18:13:58 - Tag] W/ResourceType( 1008): Bad XML block: node attributes use 0x161aa8 bytes, only have 0x14 bytes
[2014-05-03 18:13:58 - Tag] W/ResourceType( 1008): ResXMLTree_node header size 0 is too small.
[2014-05-03 18:13:58 - Tag] H:\android stuff\projects\Tag\res\menu\display_map.xml:6: error: No resource identifier found for attribute 'showAsAction' in package 'com.JTInc.tag'
[2014-05-03 18:13:58 - Tag] H:\android stuff\projects\Tag\res\menu\map.xml:6: error: No resource identifier found for attribute 'showAsAction' in package 'com.JTInc.tag'

I am not sure based on these what I should do. This the code for map.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="com.JTInc.tag.MapActivity" >

    <item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:title="@string/action_settings"
        app:showAsAction="never"/>

</menu>

So do I need to edit something on line 6? Would this be causing the resource file to not correctly work? All help is greatly appreciated. Thanks

我的Android应用程序开发遇到问题不出现,从而导致一系列的其他错误R.java文件。我相信可以弥补或后我将把这些控制台错误:

[2014-05-03 18:13:58 - Tag] W/ResourceType( 1008): Bad XML block: node attributes use 0x161aa8 bytes, only have 0x14 bytes
[2014-05-03 18:13:58 - Tag] W/ResourceType( 1008): ResXMLTree_node header size 0 is too small.
[2014-05-03 18:13:58 - Tag] H:\android stuff\projects\Tag\res\menu\display_map.xml:6: error: No resource identifier found for attribute 'showAsAction' in package 'com.JTInc.tag'
[2014-05-03 18:13:58 - Tag] H:\android stuff\projects\Tag\res\menu\map.xml:6: error: No resource identifier found for attribute 'showAsAction' in package 'com.JTInc.tag'

我不确定,在此基础上我应该做什么。此代码为map.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="com.JTInc.tag.MapActivity" >

    <item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:title="@string/action_settings"
        app:showAsAction="never"/>

</menu>

所以我需要在6行编辑吗?这会导致资源文件不正确的工作?我非常感激你的帮助。感谢

最佳答案 (Best Answer)

Inside your <item> tag (which is on line 6), you need to change app:showAsAction="never" to android:showAsAction="never". In order for R.java to build properly, your XML needs to be error-free, which is why you get the R.java error.

在你的<item>标签(这是在6行),你需要改变app:showAsAction="never"android:showAsAction="never"。为了建立正确的XML R.java文件,你要无错误的,这就是为什么你得到的R.java文件错误。

答案 (Answer) 2

本文翻译自StackoverFlow,英语好的童鞋可直接参考原文:http://stackoverflow.com/questions/23450883