Android Unit Tests with Dagger 2

前端 未结 5 1731
死守一世寂寞
死守一世寂寞 2020-12-13 06:08

I have an Android app that uses Dagger 2 for dependency injection. I am also using the latest gradle build tools that allow a build variant for unit testing and one for inst

5条回答
  •  忘掉有多难
    2020-12-13 06:20

    This is currently impossible with Dagger 2 (as of v2.0.0) without some workarounds. You can read about it here.

    More about possible workarounds:

    • How do you override a module/dependency in a unit test with Dagger 2.0?

    • Creating test dependencies when using Dagger2

提交回复
热议问题