Android开发R无法解析为变量(找不到资源错误)

Rya*_*ord 0 java resources android r.java-file

昨天我正在开发我的Android应用程序,运行正常.但是今天当我打开它时,我收到了错误R cannot be resolved to a variable,我不确定为什么会发生这种情况.在控制台中我收到此错误[2014-03-29 11:04:59 - RockPaperScissors] C:\Users\hosfo_000\workspace2\RockPaperScissors\res\menu\main.xml:6: error: Error: No resource found that matches the given name (at 'title' with value '@string/action_settings'). 有没有人有任何想法可能导致这个?我已经尝试过清理项目但是没有用.

编辑

我的main.XML的第6行是<item所以我添加了该项目的其余部分.我的整个main.xml都包含这个项目.

<item
    android:id="@+id/action_settings"
    android:orderInCategory="100"
    android:title="@string/action_settings"
    app:showAsAction="never"/>
Run Code Online (Sandbox Code Playgroud)

Lis*_*nne 5

你确定res/values/strings中存在String action_settings吗?

将其添加到res/values/strings文件中

<resources>
<string name="action_settings">Action Settings</string>
<string name="app_name">The name of your app</string>
</resources>
Run Code Online (Sandbox Code Playgroud)