[英]Espresso Dagger 2.11
Struggling to use Dagger 2 for UI testing powered by Espresso. 努力使用Dagger 2进行Espresso支持的UI测试。 I'm trying to generate a dedicated test
@Component
under androidTest
directory but getting this error: 我正在尝试在
androidTest
目录下生成专用的测试@Component
,但收到此错误:
Error:Bad service configuration file, or exception thrown while constructing
Processor object: javax.annotation.processing.Processor:
Provider dagger.android.processor.AndroidProcessor could not be instantiated:
java.lang.NoClassDefFoundError: com/google/common/collect/SetMultimap
Here's how dependencies look like: 依赖关系如下所示:
androidTestCompile "com.google.dagger:dagger:2.11",
androidTestCompile "com.google.dagger:dagger-android:2.11"
androidTestCompile "com.google.dagger:dagger-android-support:2.11"
androidTestAnnotationProcessor "com.google.dagger:dagger-compiler:2.11"
androidTestAnnotationProcessor "com.google.dagger:dagger-android-processor:2.11"
Have anyone faced with this and has a clue how to solve it? 有没有人面对这个问题,并且有一个解决的线索?
Thanks. 谢谢。
Found a solution, basically, the culprit was lying in build.gradle
just a few lines below: 找到了一个解决方案,基本上,罪魁祸首在
build.gradle
下面几行中:
configurations {
...
androidTestCompile.exclude group: 'com.google.guava', module: 'guava'
...
}
This line was excluding some useful stuff from Dagger library and preventing it from being compilable. 该行从Dagger库中排除了一些有用的东西,并使其无法编译。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.