Why can't I import AndroidJUnit4 and ActivityTestRule into my unit test class?

后端 未结 8 500
一个人的身影
一个人的身影 2020-12-08 02:02

I\'m having trouble importing some of the Android UI testing framework classes - I just can\'t figure out what is going wrong!

This is my class:

@Run         


        
相关标签:
8条回答
  • 2020-12-08 02:26

    From androidX use

    androidTestImplementation 'androidx.test:rules:1.1.1'
    
    androidTestImplementation 'androidx.test:runner:1.1.1'
    

    In your dependencies section in your app level build.gradle file

    for eg :

     dependencies {
    
         androidTestImplementation 'androidx.test:rules:1.1.1'
         androidTestImplementation 'androidx.test:runner:1.1.1'
     }
    

    Then import

    import androidx.test.rule.ActivityTestRule;

    0 讨论(0)
  • 2020-12-08 02:27

    If you migrated to AndroidX, use this:

    androidTestImplementation 'androidx.test:rules:1.1.1'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    
    0 讨论(0)
提交回复
热议问题