简体   繁体   中英

AndroidStudio not automatically importing RoboLectric objects

After setting up gradle properly, when i add for example @RunWith(RobolectricTestRunner::class) at the top of my test class, Andtoid studio does not import the class automatically when I click Alt+Enter .

When I manually type import org.robolectric.RobolectricTestRunner , i see that the class is recognized.

I have already done Invalidate Caches/Restart.. .

I am using Kotlin and AndroidStudio 4.0 and robolectric:4.3.1 .

I had to use

androidTestImplementation 'org.robolectric:robolectric:4.3.1'

instead of

testImplementation 'org.robolectric:robolectric:4.3.1'

i my module build.gradle .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM