- Android Studio 1.2 Overview
- Android Gradle Build Tools 1.2.2 Overview
- Android SDK v21
- Android AppCompat v22.0.0
- Gradle 2.3 Overview
- Robolectric 3.0-RC2 (works much much better with Android SDK v21 than older releases)
- no extra plugins necessary
- Just clone.
- Go into the project directory.
- Run
./gradlew test
and get started with robolectric.
- Import 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
Here a special example when the library has aar dependencies https://github.com/nenick/AndroidStudioAndRobolectric/tree/library-with-aar
For some use cases it is great to split tests into different modules https://github.com/nenick/android-gradle-template