To configure robolectric add @Config annotation to test class or method.
Run with custom Application class
@RunWith(RobolectricTestRunner.class)
@Config(application = MyApplication.class)
public final class MyTest {
}
Set target SDK
@RunWith(RobolectricTestRunner.class)
@Config(sdk = Build...