I have a problem with testing a Room database: when I run the test, I get this exception:
java.lang.RuntimeException: cannot find implementation for databa
I see some people around here (Vishu Bhardwaj and others on similar StackOverflow questions) complains the accepted answer does not work for them. I think it deserve mentioning I had a similar problem in a MULTI modules project that needed a trick around the accepted answer.
In my multi modules project the room database dependencies where included mostly in one basic module and exported using proper api notation but room code was split along 2 different modules. Project compiled with no warning but java.lang.RuntimeException: cannot find implementation for database... was raised on run-time.
This was fixed by adding
annotationProcessor "android.arch.persistence.room:compiler:$room_version"
in ALL modules that included Room related code.