I'm trying to test an activity including annotations from android-annotations 2.7 like @EActivity, @ViewById, etc. Every test fails because of an NoClassDefFoundError. Has anyone a working example how to combine Robotium with Android Annotations? Here's my test case:
package de.abc.view;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.Button;
import com.jayway.android.robotium.solo.Solo;
import de.abc.R;
public class WorktimeActivityTest extends ActivityInstrumentationTestCase2<WorktimeActivity_>{
private Solo solo;
public WorktimeActivityTest() {
super(WorktimeActivity_.class);
}
public void setUp() throws Exception{
solo = new Solo(getInstrumentation(), getActivity());
}
public void testSelectWorkday() {
Button button = (Button) solo.getView(R.id.selectWorkday);
solo.clickOnView(button);
}
@Override
public void tearDown() throws Exception{
solo.finishOpenedActivities();
}
}
I've found my mistake. The class that couldn't be found wasn't included in the build path. So I had to change my build path and include the generated sources from android-annotations...stupid mistake...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.