Cannot resolve ActivityTestRule after upgrading dependencies. Unable to import ActivityTestRule

人盡茶涼 提交于 2019-12-04 17:03:43

问题


I have written instrumentation tests which was working fine, but now getting error cannot resolve ActivityTestRule error after upgrading dependencies to

androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

I am using android support version 27.1.1

It is working fine with dependencies

androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

回答1:


In the most recent update of the Testing Support Library (2018-04-24), the "rules" dependency was apparently removed from the espresso-core. I'm not sure why this was done, but the release notes say this about the change:

Fixed espresso-core POM file to not pull in "rules" dependency, instead have espresso-intents POM pull it. This should be a NoOp change for developers since espresso-intents cannot be used without espresso-core.

You can fix this problem by adding the following dependency to app/build.gradle:

androidTestImplementation 'com.android.support.test:rules:1.0.2'


来源:https://stackoverflow.com/questions/50062830/cannot-resolve-activitytestrule-after-upgrading-dependencies-unable-to-import-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!