zsmb
04/12/2025, 10:47 AMfactory<Flags?> { ... }
But later on, I can't pass in a nullable type param to a get()
call:
get<Flags?>()
~~~~~~ Type argument is not within its bounds: must be subtype of 'Any'.
Shouldn't these type parameters have the same bounds?Vaibhav Jaiswal
04/14/2025, 1:42 PMFKuper
04/15/2025, 7:15 AMTask composeApplinkDebugFrameworkIosArm64 FAILED(I can provide exception stack trace's if required) Anyone got any ideas or has struggled with similar issues?
Vaibhav Jaiswal
04/15/2025, 9:15 AMcommonMain
@Module
@ComponentScan("com.medial.app.core")
internal expect class CorePlatformModule
@Module(includes = [CorePlatformModule::class])
@ComponentScan("com.medial.app.core")
class CoreModule {
@Single
fun connectivity() = Connectivity()
}
and these in the android and iOS SourceSet
@Module
@ComponentScan("com.medial.app.core")
internal actual class CorePlatformModule {
@Single
fun amplitude(context: Context) = Amplitude(
Configuration(
apiKey = AppConfig.AMPLITUDE_API_KEY,
context = context.applicationContext,
locationListening = true,
identifyBatchIntervalMillis = 0,
defaultTracking = DefaultTrackingOptions(
sessions = true,
deepLinks = true,
appLifecycles = true,
screenViews = false
)
)
)
}
@Module
@ComponentScan("com.medial.app.core")
internal actual class CorePlatformModule {
@Single
fun amplitude() = Amplitude.instance().apply {
initializeApiKey(AppConfig.AMPLITUDE_API_KEY)
defaultTracking = AMPDefaultTrackingOptions().apply {
sessions = true
deepLinks = true
appLifecycles = true
screenViews = true
}
}
}
Now when i try to run my app, i get this error
> Expect declaration module
doesn't match actual module
because parameter types are different
Does Anyone know, why this error is showing up ?Antonis Radz
04/15/2025, 9:38 AM* Exception is:
org.gradle.internal.execution.WorkValidationException: A problem was found with the configuration of task ':shared:kspCommonMainKotlinMetadata' (type 'KspAATask').
- Gradle detected a problem with the following location: '..../shared/build/generated/ksp/metadata/commonMain/kotlin'.
Reason: Task ':shared:kspDebugKotlinAndroid' uses this output of task ':shared:kspCommonMainKotlinMetadata' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ':shared:kspCommonMainKotlinMetadata' as an input of ':shared:kspDebugKotlinAndroid'.
2. Declare an explicit dependency on ':shared:kspCommonMainKotlinMetadata' from ':shared:kspDebugKotlinAndroid' using Task#dependsOn.
3. Declare an explicit dependency on ':shared:kspCommonMainKotlinMetadata' from ':shared:kspDebugKotlinAndroid' using Task#mustRunAfter.
Any ideas how to fix it?
ksp = "2.1.0-1.0.29"
kotlin = "2.1.0"
These lines are causing it:
dependencies {
add("kspCommonMainMetadata", libs.koin.ksp.compiler)
add("kspAndroid", libs.koin.ksp.compiler)
add("kspIosX64", libs.koin.ksp.compiler)
add("kspIosArm64", libs.koin.ksp.compiler)
add("kspIosSimulatorArm64", libs.koin.ksp.compiler)
}
project.tasks.withType(KotlinCompilationTask::class.java).configureEach {
if (name != "kspCommonMainKotlinMetadata") {
dependsOn("kspCommonMainKotlinMetadata")
}
}
Thanks in advance!Pablo
04/16/2025, 12:23 PMunloadKoinModules(networkModule)
loadKoinModules(networkModule)
do exist any solution for this? any solution that doesn't implies adding complexity like factories that embeds a singleton and checks if a variable has changed and then returns another singleton, I don't like that approach. I'm considering restarting the entire application, but seems that android doesn't offers a 100% supported way to achieve this. Something like unloadKoinModulesIncludingSingletons(networkModule)
will be perfect. The solution proposed by that guy is not posted in the link anymore, and the alternative of doing val api: InstanceApi = getKoin().get()
is not applicable in my case. I tryed doing stopKoin and startKoin again, but the modules are not being reloaded, don't know why.bartek.t
04/17/2025, 3:11 PMdhia chemingui
04/18/2025, 7:39 AMEduardo Ruesta
04/18/2025, 1:56 PMUncaught Kotlin exception: org.koin.core.error.InstanceCreationException: Could not create instance for '[Factory: 'com.bebi.app.viewmodel.MediaOpinionViewModel']'
Any thought?
/**
* Common Koin module for the application
*/
val appModule = module {
// Database
single { get<DatabaseProvider>().getDatabase() }
single { get<AppDatabase>().mediaOpinionDao }
}
val dataModule = module {
factoryOf(::RoomMediaOpinionRepository)
}
val viewModelModule = module {
viewModelOf(::MediaOpinionViewModel)
viewModelOf(::MediaDetailViewModel)
}
expect interface DatabaseProvider {
fun getDatabase(): AppDatabase
}
expect val nativeModule: Module
fun initKoin(config: KoinAppDeclaration? = null) {
startKoin {
config?.invoke(this)
modules(appModule, dataModule, viewModelModule, nativeModule)
}
}
Ume Channel
04/18/2025, 6:58 PMdhia chemingui
04/19/2025, 9:36 AMBruce Xia
04/20/2025, 3:46 AM// Koin
implementation "io.insert-koin:koin-core:${koinVersion}"
implementation "io.insert-koin:koin-android:${koinVersion}"
implementation "io.insert-koin:koin-androidx-compose:${koinVersion}"
implementation("io.insert-koin:koin-compose:${koinVersion}")
implementation("io.insert-koin:koin-compose-viewmodel:${koinVersion}")
Slackbot
04/25/2025, 1:08 AMKev
04/26/2025, 7:54 AMfun Routing.leaderboard() {
val service by inject<UserService>()
get<LeaderboardResource.Top100> {
service.getUserLeaderboard().map { leaderboard ->
leaderboard.map { Leaderboard(it.first, it.second) }
}.respond(HttpStatusCode.OK)
}
}
stuebingerb
04/26/2025, 11:18 AMJonathan
04/29/2025, 1:26 PM@Module class.
The Koin documentation only shows this structure for expect/actual
classes.Pablo
04/29/2025, 1:47 PMTalha
04/30/2025, 4:52 PMcommonTest
sourceset to provide dependencies and define modules? I can't find any documentation or examples of annotations being used to provide classes in tests?Thierry Kh
05/04/2025, 12:12 AMpublic inline fun <reified R, reified T1, reified T2, reified T3, reified T4, reified T5, reified T6, reified T7, reified T8, reified T9, reified T10, reified T11, reified T12, reified T13, reified T14, reified T15, reified T16, reified T17, reified T18, reified T19, reified T20, reified T21, reified T22> org.koin.core.module.Module.factoryOf(crossinline constructor: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22) -> R, noinline options: (org.koin.core.definition.BeanDefinition<R>.() -> kotlin.Unit)? /* from: org.koin.core.module.dsl.DefinitionOptions<R>? */ = COMPILED_CODE): org.koin.core.definition.KoinDefinition<R> { /* compiled code */ }
Ruben Quadros
05/04/2025, 2:22 PM@Single
expect class MyClass() (Common)
@Single
actual class MyClass actual constructor() (Android/ios)
I have tried multiple variations - expect actual module, try defining the dependency in the module but nothing seems to work.
What is the correct way for this? Thanks!Idris Ocasio
05/04/2025, 5:08 PMarnaud.giuliani
05/05/2025, 10:21 AMarnaud.giuliani
05/05/2025, 10:21 AMArsildo Murati
05/07/2025, 1:55 PMYour APK or Android App Bundle is using permissions that require a privacy policy: (android.permission.READ_PHONE_STATE).
Jimmy Nelle
05/09/2025, 8:47 AMKoinMultiplatformApplication
and getting the whole time the following error only on iOS:
[INFO] [Koin] Started 4 definitions in 0.007 ms
Uncaught Kotlin exception: kotlin.IllegalStateException: Koin context has not been initialized in rememberKoinApplication
Check the 🧵 for more contextGuyaume Tremblay
05/09/2025, 2:45 PMcommonMain
to androidMain
!
In fact, there is still a defaultModule
in the commonMain
with 2 @Factory
. All of my @Single
is now in my custom Module in build/generated/ksp/android/androidDebug/kotlin/org.koin.ksp.generated
.
I tried koin-annotations 2.0.1-RC1 seeing this PR : Fix - Fix all kmp generation from commonMain to native side by @arnaudgiuliani in #258
but still the same.
This project doesn't have any module, singleton or factory on the platform side.
Do you have any idea of what is happening?Piotr Prus
05/11/2025, 5:48 AMnamed
and property
but that does not work.
@Single
@Named("httpLoggingInterceptor")
fun provideLoggingInterceptor(): Interceptor =
HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
}
@Single
@Named("myOkHttpClient")
fun providePublicHttpClient(
authenticator: Authenticator,
@Property("addHeadersInterceptor") addHeadersInterceptor: Interceptor,
@Property("httpLoggingInterceptor") logInterceptor: Interceptor,
@Property("forbiddenInterceptor") forbiddenInterceptor: Interceptor
): OkHttpClient =
The generated code in the thread 🧵Tower Guidev2
05/12/2025, 6:36 AMorg.koin.android.ext.android.inject
& org.koin.core.component.inject
please?
and which one i should be using in my android koin 4 application.
does it matter which one i use?Pablo
05/12/2025, 8:21 AMarnaud.giuliani
05/12/2025, 5:32 PM