android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor' configuration instead
今天在导入Google官方推荐Dagger2注入框架时出现一个错误:
Error:android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor' configuration instead.
经过查找发现,在Studio升级到3.0之后原来的配置方式apt与最新版本Gradle已经不兼容,推荐使用annotationProcessor,最终的解决办法是:
一、把project目录下的build.gradle中的classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.8'删除掉;
二、把具体Module目录下的build.gradle中的apply plugin: ‘com.neenbedankt.android-apt’删除;
三、同时把dependencies中原来使用apt的改为annotationProcessor,然后Sync Now即可。
---------------------
作者:hanfengzqh
来源:优快云
原文:https://blog.youkuaiyun.com/hanfengzqh/article/details/78487169
版权声明:本文为博主原创文章,转载请附上博文链接!