在模拟器上测试App时找不到字符串资源

时间:2013-11-25 10:49:35

标签: android string resources emulation

昨天我试图在模拟设备上测试我的应用程序。

应用程序启动正确,但似乎无法找到某些字符串资源,因为它停止在字符串资源未找到异常!?

当我在真实设备上启动应用程序时,一切都运行良好,但在模拟设备上,我收到的消息是,虽然它显示在R.java文件中,但无法找到一些字符串资源。

研究对我没有帮助,因为他们所说的只是“清理你的项目”,“重建你的应用程序”,“在模拟器上删除应用程序并重新部署”但这一切都无效! 这很混乱,因为所有字符串资源都不会发生这种行为!有些被发现,有些没有!

这个行为是否为任何人所知,并且我没有用Google搜索正确的问题???

示例

string.xml (在文件夹值中)(摘要

<string name="text_str_three">Text Three</string>

活动:摘要

final String str_1 = getResources().getString(R.string.text_str_one);
final String str_2 = getResources().getString(R.string.text_str_two);   
final String str_3 = getResources().getString(R.string.text_str_three);

R.java:摘要

public static final int text_str_three=0x7f070077;

Logcat:摘要

Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f070077
找到

' text_str_one '和' text_str_two ',但' text_str_three '不是,为什么?

0 个答案:

没有答案