- Android Studio 1.2.1.1 Overview
- Android Gradle Build Tools 1.2.3 Overview, Latest Version List
- Android SDK v21
- Android AppCompat v22.1.1
- Gradle 2.4 Overview
- Robolectric 3.0-rc3
- 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
"THE BEER-WARE LICENSE": As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return. Nico Küchler