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

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.gradleAfter this you can use the ApplicationProvider.getApplicationContext() method