-
-
Notifications
You must be signed in to change notification settings - Fork 180
-
I have problem, when I log the user into "FirebaseAuth", and it gives an error in "coroutines".
This happens whenever I run it on desktop, on Android it works normally.
Inside commonMain, App.kt:
fun App() {
val context = Application().applicationContext
FirebasePlatform.initializeFirebasePlatform(object : FirebasePlatform() {
val storage = mutableMapOf<String, String>()
override fun store(key : String, value : String) = storage.set(key, value)
override fun retrieve(key : String) = storage[key]
override fun clear(key : String) { storage.remove(key) }
override fun log(msg : String) = println(msg)
})
val options : FirebaseOptions = FirebaseOptions.Builder()
.setProjectId("my-projeid")
.setApiKey("my-apikey")
.setApplicationId("my-appId")
.build()
Firebase.initialize(context, options)
MaterialTheme{
val auth = FirebaseAuth.getInstance()
auth.signInWithEmailAndPassword("teste@fripal.wms", "123456")
//compose-content
}
}
Error:
Exception in thread "OkHttp https://securetoken.googleapis.com/..." 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:81)
at kotlinx.coroutines.internal.MissingMainCoroutineDispatcher.missing(MainDispatchers.kt:112)
at kotlinx.coroutines.internal.MissingMainCoroutineDispatcher.isDispatchNeeded(MainDispatchers.kt:96)
at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:319)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:25)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:110)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.setUser(FirebaseAuth.kt:147)
at com.google.firebase.auth.FirebaseAuth.access$setUser(FirebaseAuth.kt:104)
at com.google.firebase.auth.FirebaseAuth$enqueueRefreshTokenCall1ドル.onResponse(FirebaseAuth.kt:332)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:203)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@1dec9e31, Dispatchers.Main[missing]]
Beta Was this translation helpful? Give feedback.
All reactions
Answer here GitLiveApp/firebase-java-sdk#6
Replies: 1 comment
-
Answer here GitLiveApp/firebase-java-sdk#6
Beta Was this translation helpful? Give feedback.