Android unit test Robolectric Maven : The method buildActivity(Class<MyActivity>) is undefined for the type Robolectric

 ̄綄美尐妖づ 提交于 2019-12-13 02:30:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!