问题描述:Android Dagger2生成的TestComponent类在TestClass中无法识别/被识别。
解决方法:
dependencies {
// ...
implementation 'com.google.dagger:dagger:2.x'
annotationProcessor 'com.google.dagger:dagger-compiler:2.x'
// ...
}
import com.example.yourpackage.TestComponent;
android {
// ...
defaultConfig {
// ...
javaCompileOptions {
annotationProcessorOptions {
arguments = ["dagger.gradle.incremental":"true"]
}
}
}
}
如果问题仍然存在,可能需要检查其他配置或依赖项是否正确设置。