当我运行我的测试1周前一切都很好,但现在我得到这个错误:
java.lang.NoSuchMethodError: No static method loadSingleServiceOrNull(Ljava/lang/Class;)Ljava/lang/Object; in class Landroidx/test/internal/platform/ServiceLoaderWrapper; or its super classes (declaration of 'androidx.test.internal.platform.ServiceLoaderWrapper' appears in /data/app/com.domain.myapp-1/base.apk)
at androidx.test.espresso.base.UiControllerModule.provideUiController(UiControllerModule.java:2)
at androidx.test.espresso.base.UiControllerModule_ProvideUiControllerFactory.provideUiController(UiControllerModule_ProvideUiControllerFactory.java:1)
at androidx.test.espresso.base.UiControllerModule_ProvideUiControllerFactory.get(UiControllerModule_ProvideUiControllerFactory.java:1)
at androidx.test.espresso.base.UiControllerModule_ProvideUiControllerFactory.get(UiControllerModule_ProvideUiControllerFactory.java:2)
at androidx.test.espresso.core.internal.deps.dagger.internal.DoubleCheck.get(DoubleCheck.java:6)
at androidx.test.espresso.DaggerBaseLayerComponent$ViewInteractionComponentImpl.viewInteraction(DaggerBaseLayerComponent.java:1)
at androidx.test.espresso.Espresso.onView(Espresso.java:1)
此行抛出错误:
onView(withId(R.id.sign_in_button)).perform(click())
可能是什么原因?谢谢。
3条答案
按热度按时间3mpgtkmj1#
更新时出现问题
到
恢复到版本3.3.0修复了一些问题。
ie3xauqp2#
您有多个
ServiceLoaderWrapper
,其中一些实际具有API方法,此文件由androidx.test:monitor
带来,我通过强制应用Gradle文件中的软件包版本修复了它,如下所示。lskq00tm3#
我升级到3.5.1并删除了espresso-contrib依赖项,解决了这个问题