Reputation: 29
I followed official tutorial to add robolectric to my existing android application. But when i'am trying to run a simple test i got an error:
java.lang.RuntimeException: No shadows modules found containing a org.robolectric.ShadowsAdapter
at org.robolectric.Robolectric.instantiateShadowsAdapter(Robolectric.java:223)
at org.robolectric.Robolectric.getShadowsAdapter(Robolectric.java:48)
at org.robolectric.internal.ParallelUniverse.<init>(ParallelUniverse.java:39)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
......
Here is my test:
@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 23)
public class ExampleUnitTest {
@Test
public void test() throws Exception {
}
}
build.gradle file:
dependencies {
....
testCompile 'junit:junit:4.12'
testCompile "org.robolectric:robolectric:3.1.3"
}
Upvotes: 0
Views: 373
Reputation: 4897
Try changing from:
testCompile "org.robolectric:robolectric:3.1.3"
to
testCompile "org.robolectric:robolectric:3.1.2"
Upvotes: 1