这里不做系统的整理,网络上相关的资料太多了。我就写一点我自己遇到的问题。
问题1:
e: /Users/bangbang/StudioProjects/toto/todokotlin/build/tmp/kapt3/stubs/debug/AppComponent.java:17:
错误: @Component.Builder is missing setters for required modules or components:
[com.union.bangbang.todokotlin.dagger.module.AppModule]
public static abstract interface Builder {
^
关键报错部分是第二行的位置。发生错误的原因是Dagger2的module通常是需要无参的构造函数,而我的这个Module是这个样子的
package com.union.bangbang.todokotlin.dagger.module
import android.content.Context
import android.content.res.Resources
import com.union.bangbang.todokotlin.TodoApplication
import dagger.Module
import dagger