views:

16

answers:

0

Hi,

I'm working on a project for android that uses an external library, db4o. Well, I've created a test project and I was trying to test my PersistenceManager, an object that controls the database life-cycle and exposes part of the ObjectContainer api (ObjectContainer is an object from db4o library). When I started to write the tests, I had to access a method that returned to me an object from the db4o lib, the Query object. That caused a compilation error, since this object wasn't visible to the test project.

To try and solve this problem, I put the lib reference also on the test project, which solved the compilation problem. But when I ran the tests, I receive the following error the first time an object from db4o lib is accessed (this happens in application code, not in the test code):

java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
at br.com.jongo.referencefile.PersistenceManager.grantDBStart(PersistenceManager.java:23)
at br.com.jongo.referencefile.PersistenceManager.getQuery(PersistenceManager.java:38)
at... 

I then copied the tests to the application project. In this way, I could run the tests from the application project (making some adjustments to AndroidManifest.xml). But I really would like to have the tests in a separate project. How can I do that?