Dagger 2 component not generated

前端 未结 12 1555
走了就别回头了
走了就别回头了 2021-01-31 07:21

In my module, in my base Application class

component = DaggerCompClassComponent.builder()
                .classModule(new ModuleClass()).build();
12条回答
  •  情歌与酒
    2021-01-31 08:16

    When developing on Kotlin, you should add the following lines next to their annotationProcessor counterparts:

    kapt 'com.google.dagger:dagger-android-processor:2.15'
    kapt 'com.google.dagger:dagger-compiler:2.15'
    

    and add apply plugin: 'kotlin-kapt' at the start of the same file.

    That section looks like this for me:

    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-kapt' // <- Add this line
    apply plugin: 'io.fabric'
    

提交回复
热议问题