Closed alexandrucaraus closed 1 month ago
I couldn't reproduce it in app with Koin 3.5.6 / KA 1.4.0-RC4. Do you have any way to reproduce?
I've seen generation of one KoinDefAndroidxLifecycleViewModel, not twice.
Created a repro
https://github.com/alexandrucaraus/koinannotationsrepro178.git
Fixed in 1.4.0 👌
tested on Koin Annotations 2.0-Beta1. Don't forget to use @ComponentScan
on your module classes.
Using koin annotations and view model in CMP multimodule project. The issue is when I have two feature packages, packageA and packageB, and both use generated compose view models.
The problem is in generated KoinMeta class of each module. Each dependency in generated meta class has the format,
KoinMeta-packageA package org.koin.ksp.generated public class KoinDef{PackageA}Deep public class KoinDef{pacakgeA}Deep public class KoinDefAndroidxLifecycleViewModel
KoinMeta-packageB package org.koin.ksp.generated public class KoinDef{packageB}Dep1 public class KoinDef{pacakgeB}Dep3 public class KoinDefAndroidxLifecycleViewModel
When building the app, the builder complains about the KoinDefAndroidxLifecycleViewModel, says it's duplicate, and indeed it is.
Can it be generated so it has KoinDef{package}AndroidxLifecycleViewModel format?
When I use the viewmodels as kotlin DSL it works. When I use the packages without viewmodels in similar manner it works.
Versions: koin = "4.0.0" koin-ksp = "1.4.0-RC4"