Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFound: Ldev/gitlive/firebase/Firebase #606

Open
lhalegria opened this issue Aug 29, 2024 · 1 comment
Open

NoClassDefFound: Ldev/gitlive/firebase/Firebase #606

lhalegria opened this issue Aug 29, 2024 · 1 comment

Comments

@lhalegria
Copy link

I'm trying to develop a multiplatform library using the firebase-analytics but I'm getting stuck on the firebase initialization, in both android/ios specific plarforms.

I wonder whether that's not any documentation or a sample for the same or similar purpose. I looked up around to find something but no success.

Below my implementation:

/**
 * Analytics SDK entry point.
 */
object Analytics {

    /**
     * Start the Analytics SDK.
     */
    fun initialize(platformInitializer: Platform) {
        platformInitializer.initializeFirebase()
    }
}
interface Platform {
    fun initializeFirebase()
}
import android.content.Context
import dev.gitlive.firebase.Firebase
import dev.gitlive.firebase.initialize

class AndroidPlatform(private val context: Context) : Platform {
    override fun initializeFirebase() {
        Firebase.initialize(context)
    }
}
import dev.gitlive.firebase.Firebase
import platform.UIKit.UIApplication
import dev.gitlive.firebase.initialize

class iOSPlatform(private val application: UIApplication) : Platform {
    override fun initializeFirebase() {
        Firebase.initialize(application)
    }
}

And in the application onCreate:

class App : Application() {

    override fun onCreate() {
        super.onCreate()
        Analytics.initialize(AndroidPlatform(this))
    }
}

I am receiving a java.lang.NoClassDefFoundError: Failed resolution of: Ldev/gitlive/firebase/Firebase; and I am not sure what I am doing wrong.

ps.: I've created this on discussions previously.

@Daeda88
Copy link
Contributor

Daeda88 commented Aug 30, 2024

Can you share your (relevant) gradle setup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants