MVVMPosts icon indicating copy to clipboard operation
MVVMPosts copied to clipboard

Class or Interface Missing: DaggerViewModelInjector

Open Gkundu1 opened this issue 6 years ago • 4 comments

Reporting one issue while following and implementing your code. Under package net.gahfy.mvvmposts.base Class BaseViewModel Unresolved Item DaggerViewModelInjector In the code mentioned as net.gahfy.mvvmposts.injection.component.DaggerViewModelInjector So please let us know if its class or interface.

Gkundu1 avatar Aug 30 '18 07:08 Gkundu1

Hi @Gkundu1

This class will be generated when you build your application.

So add the code in BaseViewModel.kt like below. Android Studio will not recognise it immediately but once you run your application it should pick it up.

private val injector: ViewModelInjector = DaggerViewModelInjector
            .builder()
            .networkModule(NetworkModule)
            .build()

craicoverflow avatar Oct 04 '18 20:10 craicoverflow

No, it still not working

rizmaulana avatar Oct 24 '18 14:10 rizmaulana

I do my way. It's work apply plugin: 'kotlin-kapt'

kapt {
    generateStubs = true
}

miketrinh1995 avatar Nov 02 '18 07:11 miketrinh1995

write private val injector: ViewModelInjector = DaggerViewModelInjector , then build your project and click alt+enter or import DaggerViewModelInjector

kharisazhar avatar Apr 04 '19 06:04 kharisazhar