Question

Yesterday I was working on my Android app and it was running fine. But today when i opened it, I am getting the error R cannot be resolved to a variable and i am not sure why this is happening. In the console i am getting this error [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'). Does anyone have any ideas what might be causing this? I already tried cleaning the project but that did not work.

EDIT

Line 6 of my main.XML is <item So i added the rest of that item. My entire main.xml consists of this item.

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

Solution

Are you sure the String action_settings exists in the res/values/strings?

Add this to the res/values/strings file

<resources>
<string name="action_settings">Action Settings</string>
<string name="app_name">The name of your app</string>
</resources>

OTHER TIPS

if the file is empty, you need to create it....

put this in the above named resource file.

<string name="action_settings">Your Text Here</string>

90% of the time the R error is because of an xml error

C:\Users\hosfo_000\workspace2\RockPaperScissors\res\menu\main.xml:6: error: Error:
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top