Eclipse 无法解决字符串资源错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9240995/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse could not resolve string resource error
提问by Droidman
I just created a new android project and prepared the basic structure for it. Eclipse is telling me that it couldn't resolve any strings, even the standard "hello"
or "app_name"
strings :O Restarting the IDE didn't help. Any suggestions? A screenshot can be found here
我刚刚创建了一个新的 android 项目并为其准备了基本结构。Eclipse 告诉我它无法解析任何字符串,甚至是标准字符串"hello"
或"app_name"
字符串:O 重新启动 IDE 没有帮助。有什么建议?可以在此处找到屏幕截图
采纳答案by Huang
I noticed that in your project, there is no values
resource folder. The resource in the folder with the suffix of -de
,-en
will be applied when the language on the device is German, UK, but the default folder should not be deleted. Try to add the values
folder and corresponding string.xml
to the project.
我注意到在您的项目中,没有values
资源文件夹。当设备语言为德语、英国时-de
,-en
将应用后缀为,文件夹中的资源,但不应删除默认文件夹。尝试添加values
文件夹和string.xml
项目对应。
回答by MSaudi
Go to the strings.xml file under values folder, remove the resource that's causing the problem (in this case "app_name") and write it again - new one.
转到 values 文件夹下的 strings.xml 文件,删除导致问题的资源(在本例中为“app_name”)并再次写入 - 新的。
回答by Laur
Try quick saving the strings.xml file after modifying your string resource, or save the entire project File->Save All menu... it worked for me.
尝试在修改字符串资源后快速保存 strings.xml 文件,或者保存整个项目 File->Save All 菜单...它对我有用。
回答by Aniket Thakur
Looks like you have deleted the default values folder
in your res
directory. You need to keep that as well with the other language specific values folders. You need to create res->Values->strings.xml
and add your string resources to it.
像你看上去已经删除默认values folder
在您的res
目录中。您还需要将其与其他语言特定的值文件夹一起保留。您需要创建res->Values->strings.xml
字符串资源并将其添加到其中。
回答by Rasive
First, try to clean your project
首先,尝试清理您的项目
Project > Clean
If that doesn't work, make sure you don't have a typo or something in your three strings.xml files.
如果这不起作用,请确保您的三个 strings.xml 文件中没有拼写错误或其他内容。