how to use kapt in androidTest scope

2019-04-03 19:03发布

问题:

Is there a way to use kapt for the androidtest scope? Currently I am migrating from com.neenbedankt.gradle.plugins android-apt to kapt - which works fine - but I am not sure how to do it for the androidTest scope - so replacing:

apt "com.github.hotchemi:permissionsdispatcher-processor:$permissiondispatcher_version"
apt "com.google.dagger:dagger-compiler:$dagger_version"

with

kapt "com.github.hotchemi:permissionsdispatcher-processor:$permissiondispatcher_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"

works fine - but I found no way to migrate:

androidTestApt "com.google.dagger:dagger-compiler:$dagger_version"

回答1:

As described in the documentation, it's kaptAndroidTest (and kaptTest for unit tests).