解决Android报错No resource found that matches the given name (at 'text' with value '@string/hello').

时间:2023-03-09 04:27:34
解决Android报错No resource found that matches the given name (at 'text' with value '@string/hello').

解决Android项目No resource found that matches the given name (at 'text' with value '@string/hello').

解决Android报错No resource found that matches the given name (at 'text' with value '@string/hello').

如图,此时需在res/values/strings.xml中resource中加  

<string name="hello"></string>

我的strings.xml代码如下

 <?xml version="1.0" encoding="utf-8"?>
<resources> <string name="app_name">SharedPreferencesProjuect1</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="hello"></string> </resources>