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 estSuiteBuilder.java:239)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:529)
....
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: com.xxx.wallet.HaloActivity
at com.xxx.wallet.HaloActivityTest.<init>(HaloActivityTest.java:12)
... 18 more
The apk app is loaded, AndroidManifest.xml should be fine too.
source to share
Make sure that after refactoring:
The AndroidManifest.xml of the test project is still accurate:
<instrumentation android:targetPackage="package.of.the.app.under.test">
The Test class is still accurate:
public class YourTest extends ActivityInstrumentationTestCase2<SplashScreenActivity> {
protected static final String TARGET_PACKAGE_ID = "package.of.the.app.under.test";
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
source to share