【发布时间】:2013-09-10 10:04:57
【问题描述】:
我创建了一个新的 TestProject 并在我的 testMethod 中添加了以下行:
Robolectric.getShadowApplication().getString(R.string.mystring);
我的测试失败了
android.content.res.Resources$NotFoundException: unknown resource 2131558482
控制台显示以下警告:
WARNING: No manifest file found at .\..\..\MyProject\AndroidManifest.xml.Falling back to the Android OS resources only.
To remove this warning, annotate your test class with @Config(manifest=Config.NONE).
WARNING: no system properties value for ro.build.date.utc
AndroidManifest.xml 是否需要获取字符串资源? 我尝试通过 org.robolectric.Config.properties 和 @Config 添加 Manifest,但警告仍然出现,我无法获取字符串资源。我确保清单的相对路径是正确的。 我还尝试更改 JUnit 运行配置,但这没有帮助。
【问题讨论】:
标签: android android-manifest robolectric