Home > Net >  Cannot create an instance of viewModel in koin di
Cannot create an instance of viewModel in koin di

Time:02-10

It is my viewModel module val appModule = module { viewModel { MainViewModel(get(), get()) }} application class `class App : Application() {

override fun onCreate() {
    super.onCreate()

    startKoin{
        androidLogger(if (BuildConfig.DEBUG) Level.ERROR else Level.NONE)
        androidContext(this@App)
        modules(listOf(appModule, domainModule, dataModule))
    }
}

}`

Log:

    java.lang.RuntimeException: Unable to start activity ComponentInfo{tj.alif.cleanarchitecture/tj.alif.cleanarchitecture.presentation.MainActivity}: java.lang.RuntimeException: Cannot create an instance of class tj.alif.cleanarchitecture.presentation.MainViewModel

CodePudding user response:

  •  Tags:  
  • Related