Salil
Salil

Reputation: 536

Where do I add the google-services.json for a compose multiplatform project?

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

enter image description here

Where do I add the google-services.json for a compose multiplatform project?

Upvotes: 2

Views: 663

Answers (2)

Salil
Salil

Reputation: 536

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.

Upvotes: 1

Alex Mamo
Alex Mamo

Reputation: 139019

Where do I add the google-services.json for a compose multiplatform project?

The google-services.json file should be placed in a Compose Multiplatform project inside:

root/android/app

On the other hand, the GoogleService-Info.plist file should be placed in a Compose Multiplatform project inside:

root/ios/app/KotlinMultiplatformApp

Upvotes: 0

Related Questions