Skip to content

Upgrading io.insert-koin:koin-core 3 to 4

Breaking3.5.6 → 4.2.2Breaking9Platform2Deprecated2New63Changed96Fixed92Other73

BreakingUpgrade verdict

8 breaking changes and 2 platform requirement changes.

  • Renames module to lazyModule in some contexts.
  • getAll() now returns instances in declaration order, removing the previous default sorting.
  • If you used koin-fu, switch to the Koin Annotations plugin instead.
  • Changes the BeanDef constructor, updating its API signature.
Top 5 of 12 that need code or config changes

Installs 5 packages in all (was 6).

Breaking8
Renames module to lazyModule in some contexts.
modulelazyModule
getAll() now returns instances in declaration order, removing the previous default sorting.
getAll()
Removes the koin-fu module, which moved to the Koin Annotations plugin.
koin-fu
Changes the BeanDef constructor, updating its API signature.
BeanDef
Requires ViewModel declarations that need scope injection to be inside a viewModelScope { } block.
viewModelScope
Automatic ViewModel scope creation now requires ViewModel declarations inside the viewModelScope section; declarations outside resolve against the root scope.
viewModelviewModelScope
KoinApplication is reworked to start and stop on the Compose lifecycle.
KoinApplication
Fixes Compose scope resolution with proper context handling and introduces ComposeContextWrapper to manage internal scope state.
ComposeContextWrapper
Platform2
Raises minSdk to 23 for Android.
Requires the Ktor EAP repository to be added to settings.gradle.kts.
Deprecated2
Deprecates CheckModules.
CheckModules
Restores CheckModules as deprecated code.
CheckModules