Robotium test cannot find activity class

I am using robotium to test my android app. I found it to be a very useful tool. We recently refactored to use only one action in the entire application, each page being replaced with a fragment.

However, after we start using this activity to run unit tests, the test complains about the NoClassDefound error - it could not find the activity class. I don't see any configuration changes anywhere.

Can anyone give some insight into what might be wrong, where to check, and so on?

[INFO]     java.lang.RuntimeException: Exception during suite construction
at android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests.testSuiteConstructionFailed(T
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(
at android.test.AndroidTestRunner.runTest(
at android.test.InstrumentationTestRunner.onStart(
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.NoClassDefFoundError:
... 18 more


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


source to share

1 answer

Make sure that after 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 application under test can only be found (!) In libs / yourlibrary.jar and specified in Project-> Properties-> Java Build Path-> Libraries



All Articles