51Testing软件测试论坛

标题: 【robolectric】robolectric运行一直提示getSystemService找不到。 [打印本页]

作者: leejianxia    时间: 2019-9-5 18:10
标题: 【robolectric】robolectric运行一直提示getSystemService找不到。
java.lang.NoSuchMethodError: com.android.calendar.CalendarApplication.getSystemService(Ljava/lang/Class;)Ljava/lang/Object;

        at com.android.calendar.CalendarApplication.onCreate(CalendarApplication.java:48)
        at org.robolectric.android.internal.AndroidTestEnvironment.lambda$installAndCreateApplication$0(AndroidTestEnvironment.java:276)
        at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:75)
        at org.robolectric.android.internal.AndroidTestEnvironment.installAndCreateApplication(AndroidTestEnvironment.java:276)
        at org.robolectric.android.internal.AndroidTestEnvironment.setUpApplicationState(AndroidTestEnvironment.java:169)
        at org.robolectric.RobolectricTestRunner.beforeTest(RobolectricTestRunner.java:301)
        at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$0(SandboxTestRunner.java:243)
        at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:89)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

有没有碰到类似情况的?






欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2