Firebase with unity 2020.1.0b8

Hey guys. I’m having a little trouble. Maybe this is simple but i cant get firebase to work with my version of unity.

I get “Failed to read Firebase options from the app’s resources. Either make sure google-services.json is included in your build or specify options explicitly.” on the phones logcat

Google-services.json is in the root directory. I’ve searched google for HOURS looking for a solution and nothing anyone else has said to try works. I’ve also made several fresh projects and followed firebase tutorials from the beginning very carefully. I’m not sure what else to do here :confused:

did you manage to figure this out? im hitting the same issue. Logcat says Missing google_app_id. Firebase Analytics disabled. using unity 2020 as well.
I have the google-services.json in there, doing some research. it seems unity is not copying across the google-services.xml on build.
Been working on it all week without being able to resolve the issue…

Getting the same issue, any solutions?

Hey guys, after searching high and low, went on google forums, i found that you can add a line to the custom build gradle
if you go to the following page 将 Firebase 添加到您的 Unity 项目  |  Firebase for Unity and scroll down to ‘Known Issues’
there is a section which states
Missing Firebase Android config file in Unity 2020.
and the temporary work around to fix it is there.
It is working for me now

1 Like

Is there a solution to getting Firebase to work in 2020.3.15f2?

Did you try this, the post just above yours https://discussions.unity.com/t/790811/4

Same issue in 2023 with unity version 2021

I also had this issue in Unity 2022.3.16f1 with firebase analytics 11.81. The fix was like razgames1 said. His link seems to be broken though so I’ll relink it. The reason seems to be stated by tsuharesu here. TLDR the fix is to create the directory Assets/Plugins/Android/Firebase.androidlib/res/values. Then in res/values create a file named “google-services.xml” with the following text:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="google_app_id">YOUR_GOOGLE_SERVICES_JSON_MOBILE_SDK_APP_ID</string>
    <string name="mobilesdk_app_id">YOUR_GOOGLE_SERVICES_JSON_MOBILE_SDK_APP_ID</string>
</resources>

Then create the file “Assets/Plugins/Android/Firebase.androidlib/project.properties” with the text:

target=android-31
android.library=true

You may need to change “target=android-31” to whatever version you are targetting.

Finally create the file “Assets/Plugins/Android/Firebase.androidlib/AndroidManifest.xml” with the text:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.unity.firebase" android:versionName="1.0" android:versionCode="1">
  <application>
  </application>
</manifest>

This fixed it for me.

1 Like

Why does this work? And why did I have to spend a week researching to get to this answer? All the instructions I followed on Unity, Firebase, and Google sites, and this hack works!

It worked for me too… :v:
Unity version: 2022.3.50
Firebase SDK version: 12.3.0

Tried to downgrade firebase to an older version (11.1.0) which I had in another project, but got the same error.

This hack helped me fix my issue for now. But it has its own risks. Like defining target android version explicitly…

And, has anyone tried to build for iOS? Is the issue there too?