首页 > 编程语言 > 详细

记Dagger2使用过程中的一个BUG--compileGoogleDebugJavaWithJavac

时间:2018-05-22 23:14:53      阅读:438      评论:0      收藏:0      [点我收藏+]

  项目编译可以通过,不过没有生成Dagger2的类,导致无法运行项目。。

错误提示

Error:(14, 41) 错误: 找不到符号
符号:   类 DaggerAppComponent
位置: 程序包 com.codeest.geeknews.di.component

Error:Execution failed for task ‘:geeknews:compileGoogleDebugJavaWithJavac‘.
> Compilation failed; see the compiler error output for details.

在 Terminal 调试:gradlew compileGoogleDebugJavaWithJavac -stacktrace 可以跟踪问题所在具体位置。

我的解决方式把 xxx-compiler 的引入方式都改为:annotationProcessor 。

  改前,不通过:

//di
compile rootProject.ext.dependencies["dagger"]
compile rootProject.ext.dependencies["dagger-compiler"]
compile rootProject.ext.dependencies["butterknife"]
apt rootProject.ext.dependencies["butterknife-compiler"]

  改后,完美运行:

//di
compile rootProject.ext.dependencies["dagger"]
annotationProcessor  rootProject.ext.dependencies["dagger-compiler"]
compile rootProject.ext.dependencies["butterknife"]
annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]

 

 

annotationProcessor 

记Dagger2使用过程中的一个BUG--compileGoogleDebugJavaWithJavac

原文:https://www.cnblogs.com/jooy/p/9074463.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!