I'm working on an annotation processor that generates code according to certain conditions.
The processor project is built with Maven, and using google's compile-testing I am able to test that the processor does generate the desired source code, and also verify it compiles properly.
Reading the code for similar libraries (e.g. butter knife) I've noticed the way in which the dependency for android is defined:
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
To be more specific, one of my generated classes extends an Android class (let's say SQLiteOpenHelper
), and this is how I test it:
ASSERT.about(javaSource()).that(source)
.processedWith(myProcessors())
.compilesWithoutError()
.and()
.generatesSources(theExpectedSource);
These tests pass, meaning the generated files are compiled with no problems, but when used in an actual Android project I get the following error:
java.lang.NoClassDefFoundError: android/database/sqlite/SQLiteOpenHelper
Would appreciate any help.
No comments:
Post a Comment