我在 Junit 中遇到了这个问题。我创建了一个引用 Library 项目的 Android 应用程序。我编写了一个在 Android 应用程序项目上运行的 Android 测试项目。
运行测试用例时出现以下错误:
java.lang.NullPointerException at com.jayway.android.robotium.solo.ViewFetcher.getNonDecorViews(ViewFetcher.java:188) at com.jayway.android.robotium.solo.ViewFetcher.getAllViews(ViewFetcher.java:112) at com.jayway.android.robotium.solo.Waiter.clickableItemsExist(Waiter.java:164) at com.jayway.android.robotium.solo.Waiter.waitForClickableItems(Waiter.java:150) at com.jayway.android.robotium.solo.Solo.clickOnView(Solo.java:787) at com.mycompany.myproject.test.LoginActivityInstrumentation.enterSessionPin(LoginActivityInstrumentation.java:149) com.mycompany.myproject.test.LoginActivityTest.testEnterButtonCase1(LoginActivityTest.java:174) at java.lang.reflect.Method.invokeNative(Native Method) at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214) at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199) at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:186) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:537) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1551)
任何人都可以帮忙吗?