leejianxia 发表于 2019-9-5 18:10:13

【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)

有没有碰到类似情况的?

页: [1]
查看完整版本: 【robolectric】robolectric运行一直提示getSystemService找不到。