Question

I'm trying to take Jackson into use in my Android app project. Everything else works nice but running tests in CI through Maven fail, if I run the same test from Eclipse it works but then I'm not using Maven POM files i.e. I'm not importing the project as Maven project, instead I have copied jackson JAR's into libs -folder. Jackson dependency is added to application POM like this:

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.12</version>
</dependency>    

The error I'm getting from Jenkins looks like this:

java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation

and Logcat prints the following:

Class resolved by unexpected DEX:
LmyClass;(0x41345f78):0x190e58 ref [Lorg/codehaus/jackson/map/ObjectMapper;] Lorg/codehaus/jackson/map/ObjectMapper;(0x41345f78):0x1a08b0
(LmyClass; had used a different Lorg/codehaus/jackson/map/ObjectMapper; during pre-verification)

This is caused the following line in my code:

ObjectMapper mapper = new ObjectMapper();

The test I'm running is Android InstrumentationTestCase.

Was it helpful?

Solution

Looks like this is a known issue. One solution is to add the following to your dependency:

<scope>provided</scope>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top