Skip to content

Kodein not binding  #26

@williams98

Description

@williams98

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions