Android UnitCase Android.content.res.Resources$NotFoundException
全部 我最近在我的主应用程序中创建了一个单元测试项目。然而,当我运行单元测试时,我得到以下错误Android UnitCase Android.content.res.Resources$NotFoundException,android,unit-testing,maven-3,Android,Unit Testing,Maven 3,全部 我最近在我的主应用程序中创建了一个单元测试项目。然而,当我运行单元测试时,我得到以下错误 03-19 00:25:50.579: I/TestRunner(12465): android.content.res.Resources$NotFoundException: File RuimockUnitTestTest from xml type layout resource ID #0x7f030000 03-19 00:25:50.579: I/TestRunner(12465):
03-19 00:25:50.579: I/TestRunner(12465): android.content.res.Resources$NotFoundException: File RuimockUnitTestTest from xml type layout resource ID #0x7f030000
03-19 00:25:50.579: I/TestRunner(12465): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2391)
03-19 00:25:50.579: I/TestRunner(12465): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2346)
03-19 00:25:50.579: I/TestRunner(12465): at android.content.res.Resources.getLayout(Resources.java:944)
03-19 00:25:50.579: I/TestRunner(12465): at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
03-19 00:25:50.579: I/TestRunner(12465): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-19 00:25:50.579: I/TestRunner(12465): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
03-19 00:25:50.579: I/TestRunner(12465): at android.app.Activity.setContentView(Activity.java:1892)
我已经清理了我的项目,删除了bin和gen文件,仍然没有希望。有人能给我一些建议吗?谢谢你的帮助
编辑:
单元测试代码在这里,我已经编写了单元测试:
public class ServerAPITest extends ActivityUnitTestCase<SplashScreen>{
SplashScreen mainActivity;
private Solo solo;
public ServerAPITest(){
super(SplashScreen.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation(), (SplashScreen)getActivity());
// Starts the MainActivity of the target application
startActivity(new Intent(getInstrumentation().getTargetContext(), SplashScreen.class), null, null);
// Getting a reference to the MainActivity of the target application
mainActivity = (SplashScreen)getActivity();
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
solo.finishOpenedActivities();
}
@SmallTest
public void testHello() throws Throwable{
//TODO Test Function
}
}我已经发布了代码