gahfy / MVVMPosts

Sample application with MVVM architecture
311 stars 121 forks source link

Class or Interface Missing: DaggerViewModelInjector #7

Open Gkundu1 opened 6 years ago

Gkundu1 commented 6 years ago

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.

craicoverflow commented 5 years ago

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()
rizmaulana commented 5 years ago

No, it still not working

trinhvanminh2009 commented 5 years ago

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

kapt {
    generateStubs = true
}
kharisazhar commented 5 years ago

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