I am getting the IllegalAccessError while running Android instrumentation tests.
This is Logcat output:
java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
This is my setup:
TestProject tests UnderTestProject, which includes AnotherProject in the buildpath (in ‘Projects’ tab), and exports it from ‘Order and Export’ tab. The class under test belongs to AnotherProject.
I have followed the suggestion in this stackoverflow question here for configuring build path.
The builds are being done using Maven, from command line. AnotherProject is in the pom file for both TestProject and UnderTestProject, as dependency. Is this the reason for still getting the error? How can I fix this? Include AnotherProject in pom only for UnderTestProject and include UnderTestProject in the TestProject‘s pom?
How does eclipse’s build path tie up with maven’s pom?
I am not clear about this, and any help would be greatly appreciated.
Thanks!
I tried the following, and still getting the problem:
- Removed
AnotherProjectfromTestProject‘s pom, and addedUnderTestProjectto it. - Followed the advice on this thread. My
UnderTestProjectdoesn’t even build if I add<scope>provided</scope>forAnotherProject.
I am stuck at this point, please let me know if you have a way out.
thanks!
First, follow the Libraries section on android-maven-plugin wiki page here:
Then right-click on your UnderTestProject, click Build Path -> Configure Build Path, tick Maven Dependencies in the Order and Export tab:
This works for me, hope it helps.