I'm trying to integrate Dagger 2 to be used in unit tests. Unfortunately whenever I run my test I get java.lang.NoClassDefFoundError: javax/inject/Provider
.
I have the javax dependency added in Gradle like this:
depdencencies {
...
provided 'javax.annotation:jsr250-api:1.0'
}
What I tried:
Changing provided
to compile
. Adding both compile
and testCompile
with this dependency. I also tried testProvided
but there is no such thing so it didn't work either.
Apparently the problem is that by using provided this dependency is available only compile time. Unfortunately nothing else worked so I am open to any suggestions. If more information is needed, please ask. Thanks!