- Android Studio 1.1
- android gradle build tools 1.1.0
- Robolectric 2.4
- no extra plugins or to complex custom setup necessary (but if like you can try https://github.com/robolectric/robolectric-gradle-plugin)
For details see http://nenick-android.blogspot.de/2015/02/android-studio-110-beta-4-and.html
- Just clone and open this project with Android Studio
- Change the Build Variant // Test Artifact to Unit Test (http://tools.android.com/tech-docs/unit-testing-support)
- Right click on a test and get started with robolectric.
Here an example with flavors https://github.com/nenick/AndroidStudioAndRobolectric/tree/flavors
Here an example with android library module https://github.com/nenick/AndroidStudioAndRobolectric/tree/library
For some use cases it is great to split tests in different modules https://github.com/nenick/android-gradle-template