Reputation: 19
The code provided bellow still has an Unresolved reference to DaggerAppComponent. I can't find an error.
Already did Rebuild
Here is my Application class
class CinemaApplication : SplitCompatApplication() {
private lateinit var context: Context
val appComponent: AppComponent by lazy {
DaggerAppComponent.factory().create(applicationContext)
}
}
Here is my AppComponent class
@Component
interface AppComponent {
@Component.Factory
interface Factory {
fun create(@BindsInstance context: Context): AppComponent
}
fun inject(activity: NavHostActivity)
}
Here is my Activity class
class NavHostActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
(application as CinemaApplication).appComponent.inject(this)
super.onCreate(savedInstanceState)
}
Upvotes: 0
Views: 567
Reputation: 15433
Try using kapt
apply plugin: 'kotlin-kapt'
dependencies {
implementation "com.google.dagger:dagger:2.22"
kapt "com.google.dagger:dagger-compiler:2.22"
}
Upvotes: 1