Robotium test cannot find activity class


I have been using robotium to test my android application. I found it very useful tool so far. Recently we have done a refactoring that would use only one activity in the entire application, each page will be replaced by a fragment.

However, After we start using that activity to run the unit tests, the test complains NoClassDefound error — it couldn’t find the activity class. I don’t see anywhere I have change the configuration whatsoever.

Can anybody give a clue what might be wrong , where to check and so on ?

[INFO]     java.lang.RuntimeException: Exception during suite construction
at android
at java
.lang.reflect.Method.invokeNative(Native Method)
at android
at android
at android
at dalvik
.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError:
at com
... 18 more

The app apk is loaded, AndroidManifest.xml should be ok too.

  • You must to post comments

Make sureafter refactoring:

The AndroidManifest.xml of the test project is still accurate:

<instrumentation android:targetPackage="">

The Test class is still accurate:

public class YourTest extends ActivityInstrumentationTestCase2<SplashScreenActivity> {
protected static final String TARGET_PACKAGE_ID = "";
protected Solo solo;
public Test() {
super(TARGET_PACKAGE_ID, StartingActivityOfYourAppUnderTest.class);

All libraries of the app under test can only (!) be found in libs/yourlibrary.jar and are referenced in Project->Properties->Java Build Path->Libraries

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.