Dor Dahan
Dor Dahan

Reputation: 391

Unity Firebase "Unable to load options for default app" error

When I run the app this error pops up:

Unable to load options for default app ([D:/Projects/Unity/‏‏PullApp/Assets/StreamingAssets\google-services-desktop.json, D:/Projects/Unity/‏‏PullApp/Assets/StreamingAssets\google-services.json] are missing or malformed) UnityEngine.Debug:LogError(Object) Firebase.Platform.FirebaseLogger:LogMessage(PlatformLogLevel, String) (at Z:/tmp/tmp.4oHf4jn9P6/firebase/app/client/unity/src/Unity/FirebaseLogger.cs:19) Firebase.FirebaseApp:LogMessage(LogLevel, String) (at Z:/tmp/tmp.n6hJS53AxW/firebase/app/client/unity/proxy/FirebaseApp.cs:90) Firebase.AppUtilPINVOKE:FirebaseApp_CreateInternal__SWIG_0() Firebase.FirebaseApp:CreateInternal() (at Z:/tmp/tmp.n6hJS53AxW/firebase/app/client/unity/proxy/FirebaseApp.cs:976) Firebase.FirebaseApp:m__0() (at Z:/tmp/tmp.n6hJS53AxW/firebase/app/client/unity/proxy/FirebaseApp.cs:144) Firebase.FirebaseApp:CreateAndTrack(CreateDelegate, FirebaseApp) (at Z:/tmp/tmp.n6hJS53AxW/firebase/app/client/unity/proxy/FirebaseApp.cs:537) Firebase.FirebaseApp:Create() (at Z:/tmp/tmp.n6hJS53AxW/firebase/app/client/unity/proxy/FirebaseApp.cs:144) Firebase.FirebaseApp:get_DefaultInstance() (at Z:/tmp/tmp.n6hJS53AxW/firebase/app/client/unity/proxy/FirebaseApp.cs:116) DBManager:InitializeFirebase() (at Assets/Scripts/DBManager.cs:30) DBManager:b__0_0(Task`1) (at Assets/Scripts/DBManager.cs:17) System.Threading._ThreadPoolWaitCallback:PerformWaitCallback()

It already worked perfectly on this project, and I don't know what I did that changed it (I can't use Ctrl+Z cause I've closed the app several times since it happened in trying to fix this..) I've already tried to delete all the assets related to firebase and re-import them, still the same error occurs. Also, When I press the error it self, it leds me the this line in my code:

FirebaseApp app = FirebaseApp.DefaultInstance;

tho it's the default line of firebase it self so..

Please help me. I've tried everything and I'm stuck :/

Upvotes: 2

Views: 15692

Answers (10)

CoreCoder
CoreCoder

Reputation: 21

Just add the google-services.json file in Assests/StreamingAssests This fixed my issue as well by just moving the .json file from Assets to StreaminAssets.

Upvotes: 0

Sanjay Muthu
Sanjay Muthu

Reputation: 1

Just add the google-services.json file in Assests/StreamingAssests

Upvotes: 0

Gregory Radovilskiy
Gregory Radovilskiy

Reputation: 31

google-services files should be placed into AsseStreamingAssets folder and it solve the problem.

Upvotes: 3

Omar
Omar

Reputation: 1

In my case, I just add the Google-Services JSON file to another folder called "StreamingAssets" inside the Assets folder and the error disappeared!

Upvotes: 0

DDB
DDB

Reputation: 1

I just ran into this error and found that my editor had created google-services.json.txt instead of google-services.json.

I recommend opening the files in something like Visual Studio just in case Windows is hiding extensions from you, too.

Upvotes: 0

M16aV
M16aV

Reputation: 61

In my case Special sign in filepath caused this error!

Upvotes: 6

shiyuan
shiyuan

Reputation: 11

I also encountered this problem because the project name and path appeared in Chinese, which caused the initialization failure

Upvotes: 1

Satyam
Satyam

Reputation: 47

google-services json file should be named as "google-services". Other names like "google-services(1)" will give error.

Upvotes: 4

Dor Dahan
Dor Dahan

Reputation: 391

Well nothing seem to work so I've created a new project from scratch and re-attached it to firebase and now it works perfectly fine. Still It would be nice to know what happened there...

Upvotes: 0

chenjd
chenjd

Reputation: 31

It said that "[D:/Projects/Unity/‏‏PullApp/Assets/StreamingAssets\google-services-desktop.json, D:/Projects/Unity/‏‏PullApp/Assets/StreamingAssets\google-services.json] are missing or malformed)".

You need to put the google-services.json into your Assets folder.(According to the doc, you can place the Firebase config files anywhere within the Assets folder.)

If you're registering both an iOS and an Android build target of your Unity project, you'll need to download and add the config files for both platforms.

https://firebase.google.com/docs/unity/setup

Upvotes: 0

Related Questions