firebase-kotlin-sdk
firebase-kotlin-sdk copied to clipboard
NoClassDefFound: Ldev/gitlive/firebase/Firebase
trafficstars
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.