Instrumentation run failed due to 'java.lang.IllegalAccessError' in Robotium test project with actionbar sherlock

StackOverflow https://stackoverflow.com/questions/22590545

Question

I've recently added actionbarsherlock as a dependency to my robotium test project ... And each time I try to run the tests, below error occurs
Test run failed: Instrumentation run failed due to 'java.lang.IllegalAccessError'

Any Help ?!

Was it helpful?

Solution

I faced a similar issues during instrumentation where i got the error Class ref in pre-verified class resolved to unexpected implementation

After log of struggle , i could solve the problem . The problem occurred due to android-support-v4.jar. This jar is by default created in lib folder of android project. The jars added to lib folder are used during compilation time as well as runtime for the instrumentation project. When I was running the instrumentation, the target application started using android-support-v4.jar bundled in the instrumentation project instead of its own android-support-v4.jar. This causes pre-verified class exception during runtime (as version will differ).

To solve this issue i moved out android-support-v4.jar out of lib folder and put it in a different folder (say libforcompile) and add it as external Jar (Project properties -> Java BUild Path --> Libraries --> click on Add External Jars).

THus my instrumentation project compiled fine and when it ran it used the android-support-v4.jar of the target app itself

No more error..

I hope it helps

Regards Indraneel

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top