3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Android Kotlin : UnitTestでDagger2のコンポーネントが生成されない

Posted at

暫くハマってしまったのでメモ。

結論

kapt をtestで動作させるには build.gradle にkaptTest の宣言が必要。

kaptTest 'com.google.dagger:dagger-compiler:2.7'

僕がハマっていたのはこれでした。

御託

testCompile 等から類推して適当に testKapt とかして駄目だったので、
無いのかと思っていたのが間違いでした。

apt の場合は testApt なのに…orz
最近は annotationProcessor らしい?

参考

3
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?