Has anyone else had issues adding GitLive Firebase...
# multiplatform
s
Has anyone else had issues adding GitLive Firebase library dependencies on a multiplatform project that has Desktop/JVM? I'm hitting a strange error when I try to run my desktop client after adding the dependency
Copy code
Exception in thread "main" java.lang.NoSuchMethodError: 'void androidx.lifecycle.LifecycleRegistry.setCurrentState(androidx.lifecycle.Lifecycle$State)'
	at androidx.compose.ui.scene.ComposeContainer.updateLifecycleState(ComposeContainer.desktop.kt:436)
	at androidx.compose.ui.scene.ComposeContainer.onChangeWindowFocus(ComposeContainer.desktop.kt:216)
	at androidx.compose.ui.scene.ComposeContainer.setWindow(ComposeContainer.desktop.kt:297)
	at androidx.compose.ui.scene.ComposeContainer.<init>(ComposeContainer.desktop.kt:164)
	at androidx.compose.ui.scene.ComposeContainer.<init>(ComposeContainer.desktop.kt:82)
	at androidx.compose.ui.awt.ComposeWindowPanel.<init>(ComposeWindowPanel.desktop.kt:56)
	at androidx.compose.ui.awt.ComposeWindow.<init>(ComposeWindow.desktop.kt:65)
	at androidx.compose.ui.awt.ComposeWindow.<init>(ComposeWindow.desktop.kt:63)
	at androidx.compose.ui.window.Window_desktopKt$Window$3.invoke(Window.desktop.kt:182)
	at androidx.compose.ui.window.Window_desktopKt$Window$3.invoke(Window.desktop.kt:176)
	at androidx.compose.ui.window.Window_desktopKt$Window$10.invoke(Window.desktop.kt:409)
	at androidx.compose.ui.window.Window_desktopKt$Window$10.invoke(Window.desktop.kt:406)
	at androidx.compose.ui.window.AwtWindow_desktopKt$AwtWindow$2.invoke(AwtWindow.desktop.kt:70)
	at androidx.compose.ui.window.AwtWindow_desktopKt$AwtWindow$2.invoke(AwtWindow.desktop.kt:69)
	at androidx.compose.runtime.DisposableEffectImpl.onRemembered(Effects.kt:82)
	at androidx.compose.runtime.CompositionImpl$RememberEventDispatcher.dispatchRememberObservers(Composition.kt:1295)
	at androidx.compose.runtime.CompositionImpl.applyChangesInLocked(Composition.kt:984)
	at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:1005)
	at androidx.compose.runtime.Recomposer.composeInitial$runtime(Recomposer.kt:1099)
	at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:633)
	at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:619)
	at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2.invokeSuspend(Application.desktop.kt:221)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
I'm using version 1.12.0 of dev.gitlive:firebase-auth and compose-plugin = "1.6.10-rc01"
I added it just to desktop/android right now instead of common because it doesnt have WASM compatibility yet
I do see some unexpected information when hovering over the line that crashes
That's from ComposeContainer.desktop.kt, seems odd that it 'thinks' that belongs to the firebase-java-sdk
Seems like the gitlive dependency is using v2.4.0 of androidx.lifecycle whereas v2.7.0 is used without it
b
I'm also getting this crash on desktop after upgrading to the 1.6.10-RC01 and Kotlin 2.0.0-rc2
b
I'd love to see more of this if you've got it working. > Could not find android.arch.lifecyclecommon1.1.1. when trying to build the desktop app
b
@bryankeltonadams I haven't gotten it working yet, if it really is a problem with dependencies in the library we might get an official fix soon now that 1.6.10 is officially released today. Didn't seem worth the effort troubleshooting unreleased conflicts.
b
Were you able to roll back any specific versions to get it working? Or it just never worked for you?
b
I never got it working on 1.6.10-RC02, I'm still on 1.6.2
b
I see, so if I roll back to 1.6.2 I should be able to get it working?
b
Assuming it's the same problem, it works fine on 1.6.2 yes
b
awesome!
weird, I'm on
Copy code
compose = "1.6.7"
compose-plugin = "1.6.2"
but I get the same crash
b
Now sure what your 1.6.7 stuff is, for common code it's only 1.6.2 for all compose items. Gitlive Firebase stuff is 1.12.0
b
Ok, I'll try downgrading the 1.6.7
b
which firebase libraries are you trying to use as well? I'm only using these ones
Copy code
implementation("dev.gitlive:firebase-firestore:1.12.0")
implementation("dev.gitlive:firebase-common:1.12.0")
implementation("dev.gitlive:firebase-functions:1.12.0")
implementation("dev.gitlive:firebase-auth:1.12.0")
Oh and I guess Crashlytics, but thats not in the common
And I had to put implementation("dev.gitlivefirebase auth1.12.0") in desktop as well to work properly
b
Oh wow I dont think I have that, but I'm trying to use firestore not auth.
b
Then I imagine you'd just need firestore/common in common
b
And then also the java SDk in desktop that's failing, right?
b
You need to follow their guide for that part ya
b
Okay, I haven't done any of the init stuff in the desktop side, would that also cause the crash? I thought I'd at least be able to build the app with just the firebase.initialize() and not referencing the code in the composable.
b
I did that a long time ago, let me pull out the init and see what happens
b
Ok cool. Thanks
b
I get this exception when it's removed Exception in thread "main" java.lang.NullPointerException: null cannot be cast to non-null type android.content.Context at dev.gitlive.firebase.FirebaseKt.initialize(firebase.kt:24)
b
Hmm, I'm going to change my dependencies like you mentioned and do the full init setup and see what happens.
I guess I do have that already.
Copy code
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)
})
still getting, Exception in thread "main" java.lang.NoSuchMethodError: 'void androidx.lifecycle.LifecycleRegistry.setCurrentState(androidx.lifecycle.Lifecycle$State)'
b
And you're on compose 1.6.2 and Kotlin 1.9.23?
b
I updated to the latest release after I filed an issue on the gitlive java sdk and it works
Maybe try updating that and then your dependencies and see if that fixes it
yeah I am on both those versions
b
For anyone else having this issue, Gitlive did a new release of the java sdk 0.4.3 which specifically mentions lifecycle additions. The Kotlin SDK doesn't appear to have it yet, but I imagine it will sooner than later. And its working for Bryan, so yay! https://github.com/GitLiveApp/firebase-java-sdk/releases
122 Views