我的Android项目中有模块。其中一个模块(例如,moduleA)使用另一个模块(moduleB)作为依赖项:
dependencies {
api project(':moduleB')
}
我也有合适的和老的gradle plagin。现在,我从gradle文件中删除apt,升级插件版本并得到错误:
Annotation processors must be explicitly declared now. The following
dependencies on the compile classpath are found to contain annotation
processor. Please add them to the annotationProcessor configuration.
- moduleB.jar (project :moduleB)
如果我们使用一些外部依赖关系,我们会这样做(例如)来解决此问题:
compile 'com.google.dagger:dagger:2.8'
annotationProcessor 'com.google.dagger:dagger-compiler:2.8'
但是,当注释处理器位于gradle模块内部时,我该怎么办?您能解释一下吗,因为我对此领域不了解,通常我只是简单地遵循这句话
compile 'com.google.dagger:dagger:2.8'
annotationProcessor 'com.google.dagger:dagger-compiler:2.8'
来自库提供程序的存储库。我尝试研究这种情况,但是没有发现类似的情况。
答案 0 :(得分:0)
project(':moduleB')
只是一种指定项目间依赖关系的方法,就像使用“完整”坐标(com.google.dagger:dagger:2.8
)一样。因此,要将另一个模块用作注释处理器,只需使用
dependencies {
…
annotationProcessor(project(":moduleB"))
…
}