So I am using Robotium and my test class is extending the ActivityInstrumentationTestCase2
class. I have imported the v7 support library in my main project and also in the test project as libraries.
Now what I don't understand is that the test class is working when I change the class under test to extend Activity
but when I change it to ActionBarActivity
it returns a NoClassDefFoundError
.
Am I missing anything?
Here is the Log I am getting
04-11 21:32:16.551: E/dalvikvm(23925): Could not find class 'com.example.project.ActivityClass', referenced from method com.example.project.tests.ActivityClass.<init>
Ensure you export the v7 support library referenced in test project.
Right click on the test project, properties->java build path->order and export tab.
For an example see step 5 under "Setup" Section here: http://www.stevenmarkford.com/android-ui-testing-with-espresso-basics-tutorial/ (although this is showing how to export the espresso library the same would apply in this case)
I think your library v7 app compat has an import problem.
Try this:
Import support library as a project from "sdk/extras/android/support/v7/appcompat".
Reference library in your project (for Eclipse, "Properties - Android - Add"
).
Build projects (for Eclipse, "Projects - Build All"
). Make sure, you have "android.support.v7.appcompat"
in your main project gen folder.
If it still doesn't solve your problem, restart eclipse and clean and rebuild project
If the problem persists, remove the support library from you computer and redownload it and follow above mentioned steps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With