Android Lollipop,Robotium脚本无效。获取服务意图必须是显式的act = com.bitbar.testdroid.monitor.ScreenshotService

时间:2015-08-04 08:17:55

标签: android android-5.0-lollipop robotium

我刚将手机升级到Android Lollipop,现在我的Robotium脚本无法正常工作。

我打电话时会抛出以下异常:

solo = new ExtSolo(getInstrumentation(), getActivity(), this.getClass().getCanonicalName(), getName());



java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.bitbar.testdroid.monitor.ScreenshotService }
at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:2052)
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:2160)
at android.app.ContextImpl.bindService(ContextImpl.java:2138)
at com.bitbar.recorder.extensions.ScreenshotUtils.<init>(ScreenshotUtils.java:50)
at com.bitbar.recorder.extensions.ExtSolo.<init>(ExtSolo.java:152)
at ie.eureka.moveit4.test.activity.SuperTest.setUp(SuperTest.java:176)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1873)

有什么建议吗?

1 个答案:

答案 0 :(得分:2)

在此类“com.bitbar.recorder.extensions.ScreenshotUtils”中,隐式调用com.bitbar.testdroid.monitor.ScreenshotService类。您现在需要通过类名显式调用服务,而不是通过Intent中的过滤器。

相关问题