GitLiveApp / firebase-kotlin-sdk

A Kotlin-first SDK for Firebase
https://gitliveapp.github.io/firebase-kotlin-sdk/
Apache License 2.0
1.11k stars 153 forks source link

App crashing in Desktop with Module with the Main dispatcher is missing. #566

Closed dinesh-thiyagarajan closed 2 months ago

dinesh-thiyagarajan commented 2 months ago

Getting this below error even after matching the coroutines versions. Was getting this error only after adding gitLive SDK to the project while using auth and firebase - database modules. but the same code is working fine while running this in android app

Screenshot 2024-07-15 at 9 24 51 PM

Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android' and ensure it has the same version as 'kotlinx-coroutines-core' at kotlinx.coroutines.internal.MainDispatchersKt.throwMissingMainDispatcherException(MainDispatchers.kt:77) at kotlinx.coroutines.internal.MissingMainCoroutineDispatcher.missing(MainDispatchers.kt:108) at kotlinx.coroutines.internal.MissingMainCoroutineDispatcher.isDispatchNeeded(MainDispatchers.kt:92) at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:315) at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:26) at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:21) at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:88) at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:123) at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:52) at kotlinx.coroutines.BuildersKt.launch(Unknown Source) at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:43) at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source) at auth.viewModels.AuthViewModel.<init>(AuthViewModel.kt:21) at ComposableSingletons$MainKt$lambda-1$1.invoke(main.kt:44) at ComposableSingletons$MainKt$lambda-1$1.invoke(main.kt:18)

dinesh-thiyagarajan commented 2 months ago

https://github.com/GitLiveApp/firebase-java-sdk/issues/6

Updating coroutines version to org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.9.0-RC . seems to have fixed the issue on Mac