Your TestApplication
class should extend your own Application
class, not android.app.Application
, and it should be in the same package as your Application
.
... however I have all tests in a different package.
That shouldn't be a problem. Put your TestApplication
in your test module, but use the package from Application
.
e.g., if you're using maven, the files would live here:
src/main/java/com/example/Application.java
src/test/java/com/example/TestApplication.java