[英]Dagger2: cannot find symbol class Dagger*Component
I am looking into this example: https://github.com/amitshekhariitbhu/Android-MVP-Sample-Application 我正在研究此示例: https : //github.com/amitshekhariitbhu/Android-MVP-Sample-Application
When I try to convert that project to Kotlin by clicking on --> Code --> Convert Java file to Kotlin file for some files.. 当我尝试通过单击->代码->某些文件将Java文件转换为Kotlin文件将项目转换为Kotlin时。
I get: 我得到:
error: cannot find symbol class DaggerActivityComponent for BaseActivity.java 错误:找不到BaseActivity.java的符号类 DaggerActivityComponent
error: cannot find symbol class DaggerApplicationComponent for MyApplication.java 错误:找不到 MyApplication.java的符号类DaggerApplicationComponent
Whats wrong? 怎么了?
You will need the following in build.gradle
file: 您将在build.gradle
文件中需要以下内容:
apply plugin: 'kotlin-kapt'
…
dependencies {
…
final dagger_version = '2.17'
implementation "com.google.dagger:dagger:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"
compileOnly 'javax.annotation:javax.annotation-api:1.3.2'
}
For a complete step by step guide, see https://medium.com/@xiwei/simplest-dagger-example-920bbd10258 有关完整的分步指南,请参阅https://medium.com/@xiwei/simplest-dagger-example-920bbd10258
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.