开发者

Android - Junit - Tested project uses external Jar

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 writt开发者_JAVA百科en 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?


(In order to remove this question from the "Unanswered" filter...)

The solution is outlined here:

Android Testing: External libraries

The LIB should be exported from A to make it accessible from B.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜