I’m using `kotlin-inject` + `kotlin-inject-anvil` ...
# kotlin-inject
m
I’m using
kotlin-inject
+
kotlin-inject-anvil
and my component is
interface ApplicationComponent : ApplicationComponentMerged
which is fine.
ApplicationComponentMerged
is generated but
ApplicationComponent
can’t access things provided by components that
ApplicationComponentMerged
extends/inherits
1
I’m using Circuit code generation and the hierarchy is:
Copy code
@Origin(value = CameraPresenterFactory::class)
public interface CameraPresenterFactory {
  @Provides
  @IntoSet
  public
      fun provideCameraPresenterFactoryFactoryMultibinding(cameraPresenterFactory: CameraPresenterFactory):
      Presenter.Factory = cameraPresenterFactory
}
-----------------
public interface ApplicationComponentMerged :
    TechMappsSevenwondersduelscoringCameraCameraPresenterFactory
---------------
public class InjectApplicationComponent : ApplicationComponent,
but there is an error where
provideCameraPresenterFactoryFactoryMultibinding
which exists inside
CameraPresenterFactory
gives Unresolved reference:
Copy code
public class InjectApplicationComponent : ApplicationComponent, ScopedComponent {
  override val _scoped: LazyMap = LazyMap()

  override val circuit: Circuit
    get() = circuit(
      presenterFactories = setOf(
        provideCameraPresenterFactoryFactoryMultibinding(
          cameraPresenterFactory = CameraPresenterFactory()
        )
      ),
      uiFactories = setOf(
        provideCameraUiFactoryFactoryMultibinding(
          cameraUiFactory = CameraUiFactory()
        )
      )
    )
}
r
Any chance that you misuse Gradle
api
vs
implementation
dependencies?
m
tried both, neither works
r
What's the exact error message?
j
i get similar
Copy code
e: file:///.../build/generated/ksp/jvm/jvmMain/kotlin/com/joshafeinberg/common/InjectAppComponent.kt:266:9 Unresolved reference 'provideAddTransactionPresenterFactoryFactoryMultibinding'.
however, in the build folder I do have
Copy code
@Origin(value = AddTransactionPresenterFactory::class)
public interface
    ComJoshafeinbergCommonFeaturesAddtransactionAddTransactionPresenterFactory {
  @Provides
  @IntoSet
  public
      fun provideAddTransactionPresenterFactoryFactoryMultibinding(addTransactionPresenterFactory: AddTransactionPresenterFactory):
      Presenter.Factory = addTransactionPresenterFactory
}
i'm kind of wondering, and not sure if you have the same problem Marko, if theres something wrong with my gradle setup as I'm getting the IDE a warning of
Unresolved reference: AppComponentMerged
even though it compiles
r
This is strange. Not sure if this is Circuit related (maybe @Zac Sweers has an idea), a dependency issue (but then I’d expect an issue with the class and not the function), Kotlin 2.0 or any other reason. I assume this happens in a multi-module setup. A sample would make this a lot easier 😕
z
I saw a similar error here: https://kotlinlang.slack.com/archives/C0255B8KX7W/p1726371615948419, but not in jvmMain
r
m
I’m getting same error as Josh, and my error happens inside
androidMain
codegen directory.
j
i've ended up with a really weird fix for this, still trying to make a small reproducible sample though to file the bug i have my AppComponent defined like this
Copy code
@AppScope
@Component
@MergeComponent
internal abstract class AppComponent(...) : AppComponentMerged2
AppComponentMerged2
is kind of where the magic worked. this is just
expect interface AppComponentMerged2
and then in all my sourcesets i have an actual defined as
actual interface AppComponentMerged2: AppComponentMerged
So this does seem to be a very similar error to the one Chris reported. this workaround works for now though
z
hmm, that doesn’t seem to resolve the issue I linked above, but maybe that’s further confirmation that my error is a different one and specific to iosMain source sets
m
what about
java.lang.IllegalStateException: Storage for [.../build/kspCaches/android/androidDebug/symbolLookups/id-to-file.tab] is already registered
with same setup?
z
that looks like an unrelated KSP ephemeral IC state issue