ResoCoder / forecast-mvvm-android-kotlin

Forecast MVVM app as found in the free course.
https://www.youtube.com/playlist?list=PLB6lc7nQ1n4jTLDyU2muTBo8xk0dg0D_w
339 stars 163 forks source link

Kodein not binding #26

Open williams98 opened 4 years ago

williams98 commented 4 years ago

i'm facing while working with weather forecast implemented as done in tutorial since then i'm facing kodein binding issue

Issue: org.kodein.di.Kodein$NotFoundException: No binding found for bind() with ?().? { ? }

`class ForecastApplication : Application(), KodeinAware {

override val kodein = Kodein.lazy {
    import(androidXModule(this@ForecastApplication))

    bind() from singleton { ForecastDatabase(instance()) }
    bind() from singleton { instance<ForecastDatabase>().currentWeatherDao() }
    bind<ConnectivityInterceptor>() with singleton { ConnectivityInterceptorImpl(instance()) }
    bind() from singleton { WeatherStackApiService(instance()) }
    bind<WeatherNetworkDataSource>() with singleton { WeatherNetworkDataSourceImpl(instance()) }
    bind<ForecastRepository>() with singleton { ForecastRespositoryImpl(instance(), instance()) }
    bind() from provider { CurrentWeatherViewModelFactory(instance()) }
}
override fun onCreate() {
    super.onCreate()
    AndroidThreeTen.init(this)
}

}`

`override val kodein by closestKodein() private val viewModelFactory: CurrentWeatherViewModelFactory by instance() private lateinit var viewModel: CurrentWeatherViewModel

viewModel = ViewModelProvider(this, viewModelFactory) .get(CurrentWeatherViewModel::class.java)

`

Kodien version : 6.5.4

mubaracktahir commented 4 years ago

I also had a similar issue mine was at runtime, it says "can't find ForecastDatabase_impl"