views:

24

answers:

1

I have some java code (compiles nicely for Android) in a library project (LIB) that I want to use in an another Android project (A).

As LIB's code is unlikely to change much, I opted for adding it as a jar to A. It works fine.

I have another project that is an Android instrumentation project, testing the first Android project (B).

So what we have now is A including LIB as an external jar, and B testing A.

The problem starts when I want to access from B code written in LIB. From what I see, unless I add LIB as an external jar to B, it refuses to compile (that is, it cannot access the code in the LIB jar that is included in A).

I am reluctant to add LIB as an external jar to B because: 1. It doesn't feel right, and 2. When running the tests it fails with:

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

I found Mike's question, but his solution only covers compiling using an ant script, and I currently prefer to use the Eclipse IDE for this project.

Any idea how can I solve this issue?

+1  A: 

Solved by following This blog post.

It seems that I should have exported LIB from A, to make it accessible from B.

Amit