项目编译可以通过,不过没有生成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 

相关文章:

  • 2022-12-23
  • 2021-04-30
  • 2022-12-23
  • 2022-12-23
  • 2021-08-13
  • 2021-04-11
  • 2021-05-02
  • 2021-10-25
猜你喜欢
  • 2022-12-23
  • 2022-01-09
  • 2021-06-20
  • 2022-12-23
  • 2021-11-20
  • 2021-11-06
  • 2021-07-30
相关资源
相似解决方案