I am trying to get Robolectric tests up and working in our current project, and not having a lot of luck. My preference would be to get these to run within Android Studio 1
I have faced same errors. We use several flavors and buildtypes So, there are steps to make it working:
1) Android studio tests run configuration
You have to set working directory to $MODULE_DIR$ in Windows too. robolectric.org/getting-started/ should say that.
2) Unit test should be annotated like this:
@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml", packageName = "com.example.yourproject")
public class SomeFragmentTest {
Here we have plain link to manifest file and packageName