Robolectric RuntimeEnvironment.application is deprecated, where is ApplicationProvider.getApplicationContext()?

As described in the Robolectric Migration Guide to 4.0 you have to add the androidx test core dependencies testImplementation 'androidx.test:core:1.0.0' to your build.gradle
After this you can use the ApplicationProvider.getApplicationContext() method

Leave a Comment