简体   繁体   English

Android无法识别字符串资源

[英]Android not recognizing string resource

In my android app, I have a string 在我的android应用中,我有一个字符串

<string name="action_upload">Upload Image</string>

in the strings file. 在字符串文件中。 Then in a menu file I have 然后在菜单文件中

navigation_screen.xml navigation_screen.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="android.arin.NavigationScreen" >

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

    <item
    android:id="@+id/action_forward"
    android:icon="@drawable/ic_action_forward"
    android:title="@string/action_forward"
    android:showAsAction="ifRoom" />

</menu>

However when I try to run it, I get an error saying: 但是,当我尝试运行它时,出现错误消息:

[2014-06-19 17:26:18 - ARIN] W/ResourceType( 9060): ResXMLTree_node size 0 is smaller than header size 0x100.
[2014-06-19 17:20:26 - ARIN] C:\Users\NAME\Documents\NAME\NAME\ARIN\res\menu\navigation_screen.xml:5: error: Error: No resource found that matches the given name (at 'title' with value '@string/action_upload').

I even tried a Project clean in eclipse, but still problem persists. 我什至在Eclipse中尝试了Project清理,但问题仍然存在。

Does anyone know how to fix it? 有谁知道如何修理它?

Thanks 谢谢

This may seem like a weird answer, but did you save the xml file. 这似乎是一个奇怪的答案,但是您是否保存了xml文件。 Hit Ctrl-S and try it again. 按Ctrl-S,然后重试。

If that doesn't work: Are the other strings you declared in the strings.xml file visible? 如果这不起作用:您在strings.xml文件中声明的其他字符串是否可见?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM