I have an Android application that I test using @RunWith(RobolectricTestRunner.class)
. When I run all tests together in Android Studio, it works. But when I run a test or test class separately, I get this error:
java.lang.UnsupportedOperationException: Robolectric does not support API level 1.
Note that both the minimum and target API levels are specified in the manifest file. It seems that the environment is not setup properly. Adding @Config(emulateSdk=23)
makes the test start but the test fails while accessing resources.
Any idea of what could cause the test environment not to load properly?