问题
I am trying to creat some tests for my android application in Maven/Eclipse with Roboelectric.
I have an error in the method buildActivity() from the Robolectric class:
The method buildActivity(Class<MyActivity>) is undefined for the type Robolectric
This is how I am calling it :
@Before
public void setup() {
activity = Robolectric.buildActivity(StartActivity.class).create()
.get();
}
And this is my dependency in POM.xml :
<dependency>
<groupId>org.robolectric</groupId>
<artifactId>robolectric</artifactId>
<version>2.0-alpha-2</version>
<scope>test</scope>
</dependency>
Every suggestion is welcome. Thank you for your time.
来源:https://stackoverflow.com/questions/23089050/android-unit-test-robolectric-maven-the-method-buildactivityclassmyactivity