Reputation: 5728
I was just trying to use Robotium in an Android JUnit Test, but the Testing always fails with an error:
java.lang.NoClassDefFoundError: com.jayway.android.robotium.solo.Solo
thrown at solo = new Solo(getInstrumentation(), getActivity()); in the setUp() method:
protected void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation(), getActivity());
}
I read somewhere that this could be related to the Android SDK revision 17, but I cannot confirm this, as I first tried Robotium already with SDK 17.
The Robotium jar is properly added to the project build path.
Has anyone encountered similar problems?
Regards K.
Upvotes: 13
Views: 11928
Reputation: 439
If the problem still persist just restart your eclipse. I was having same problem even after importing robotium.jar but after restarting eclipse it worked fine.
Upvotes: 1
Reputation: 5839
I did this configuration to solve the problem
Note : I put robotium first one.
Upvotes: 8
Reputation: 424
What I did to fix the bug was :
You are good to go !
Upvotes: 2
Reputation: 1716
Had the same issue on SDK 17. Adding the robotium jar to lib and exporting helped. Also had to change the deprecated super call in the constructor from super(String,Class) to super(Class) to make it work.
Upvotes: 3
Reputation: 1919
You will need to export the Robotium jar by going to Properties-> Java Build Path -> Order and Export. Then check the Robotium jar file.
Upvotes: 25
Reputation: 14444
I had the same problem today. I solved by importing the jar into the libs directory of the test project and then adding it to the Build Path Libraries:
TestProject Properties -> Java Build Path -> Libreries -> Add JARs... -> TestProject/libs/robotium-solo-3.1.jar
Upvotes: 30