Skip to content

Upgrading io.insert-koin:koin-compose 1 to 4

Breaking1.1.5 → 4.2.2Breaking9Platform2Deprecated2New65Changed87Fixed82Other63

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 default sorting.
  • The koin-fu module is gone; its functionality now lives in the Koin Annotations plugin.
  • Changes the BeanDef constructor, updating its API signature.
Top 5 of 12 that need code or config changes
Breaking8
Renames module to lazyModule in some contexts.
modulelazyModule
getAll() now returns instances in declaration order, removing the 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
ViewModel declarations requiring scope injection must now 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 cycle.
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.
minSdk
Requires the Ktor EAP repository to be added to settings.gradle.kts.
settings.gradle.ktsmaven()
Deprecated2
Deprecates CheckModules.
CheckModules
Restores CheckModules as deprecated code.
CheckModules