annotationProcessor 引用后编译时不生效问题

Gradle升级后Processor无法在编译时生效

升级fit后忽然发现在annotaionProcessor后编译并没有生成。原因在哪里呢?将fit库的gradle版本从4.6升级到了5.6.4,原来从gradle4.7开始不再帮助生成,需要我们自己在库中解决。

两种方案

1、processor中添加anntationProcessor

在comiple库的build.gradle中加入后,其它不需要动即可(我的库使用的AutoServerice)

1
annotationProcessor deps.autoservice
2、自己写一个gradle build plugin

需要用户使用时引入gradle plugin方能生效

1
apply plugin: 'custom.plugin'

参考

Incremental annotation processing
annotation processor 为啥没有被调用?
Annotation processor @autoservice
Butter Knife