Cannot resolve ActivityTestRule after upgrading dependencies. Unable to import ActivityTestRule

前端 未结 2 1300
渐次进展
渐次进展 2021-02-07 00:16

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

android         


        
2条回答
  •  盖世英雄少女心
    2021-02-07 01:13

    AndroidX Test includes another API,ActivityScenario that is currently in beta. This API works in a variety of testing environments and provides thread safety within the tests that use it. Consider using ActivityScenarioRule or ActivityScenario instead.

    import androidx.test.ext.junit.rules.ActivityScenarioRule
    
    ActivityScenarioRule(YourActivity::class.java)
    

提交回复
热议问题