I have created a project using the Kotlin Multiplatform Wizard.
I have a project in Firebase and have downloaded the google-services.json file.
Do I place this file at the same level as composeApp or at the level of androidApp?
I have tried adding these files at both locations but always get this exception –
java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.github.ksalil.gamehub. Make sure to call FirebaseApp.initializeApp(Context) first.
I also added the FirebaseApp.initializeApp(Context)
as suggested in the exception in onCreate()
of my application class.
This is the project structure
Where do I add the google-services.json for a compose multiplatform project?
2
Answers
I was missing this plugin,
id("com.google.gms.google-services") version "4.4.2" apply false
in the respective build files. After adding it I can access Firebase in my app.The
google-services.json
file should be placed in a Compose Multiplatform project inside:On the other hand, the
GoogleService-Info.plist
file should be placed in a Compose Multiplatform project inside: