Search Unity

Bug Firebase SDK Generation of the Firebase Android resource file google-services.xml failed

Discussion in 'Scripting' started by Nicokam, Dec 11, 2020.

  1. Nicokam

    Nicokam

    Joined:
    May 28, 2020
    Posts:
    64
    Hello Everyone.

    So, I don't know if this is the place to post this, but I already posted in the Github page of the project SDK's and no one answered, so I figured it wouldn't hurt to ask.

    I am trying to do Authentication and Analytics through Firebase SDK's for Unity. I followed all the footsteps listed in their documentation and got it to work at some level.

    The Auth is working. I can register new users, and it is giving me the correct errorCodes (Exceptions).
    Here it's where it gets weird. Some Basic functions of unity like changing scene, changing texts dynamically, etc..

    This is the error I keep getting:

    Generation of the Firebase Android resource file google-services.xml from Assets/Firebase/GoogleService-Info.plist failed.

    If you have not included a valid Firebase Android resources in your app it will fail to initialize.

    "python" "/Users/xxxxx/Documents/ProgrammingCloud/Unity/yyyyy/Assets/Firebase/Editor/generate_xml_from_google_services_json.py" -i "Assets/Firebase/GoogleService-Info.plist" -l --plist

    Could not find key in plist file: [DATABASE_URL]

    You can start to diagnose this issue by executing ""python" "/Users/xxxxx/Documents/ProgrammingCloud/Unity/yyyyy/Assets/Firebase/Editor/generate_xml_from_google_services_json.py" -i "Assets/Firebase/GoogleService-Info.plist" -l --plist" from the command line.

    UnityEngine.Debug:LogError(Object)

    Firebase.Editor.GenerateXmlFromGoogleServicesJson:RunResourceGenerator(IEnumerable`1, String, Boolean) (at Z:/tmp/tmp.DPw5MV1I7c/firebase/app/client/unity/editor/src/GenerateXmlFromGoogleServicesJson.cs:542)

    Firebase.Editor.GenerateXmlFromGoogleServicesJson:ReadBundleIds(String) (at Z:/tmp/tmp.DPw5MV1I7c/firebase/app/client/unity/editor/src/GenerateXmlFromGoogleServicesJson.cs:407)

    Firebase.Editor.GenerateXmlFromGoogleServicesJson:UpdateConfigFileDirectory() (at Z:/tmp/tmp.DPw5MV1I7c/firebase/app/client/unity/editor/src/GenerateXmlFromGoogleServicesJson.cs:295)

    Firebase.Editor.GenerateXmlFromGoogleServicesJson:CheckConfiguration() (at Z:/tmp/tmp.DPw5MV1I7c/firebase/app/client/unity/editor/src/GenerateXmlFromGoogleServicesJson.cs:246)

    Firebase.Editor.GenerateXmlFromGoogleServicesJson:<GenerateXmlFromGoogleServicesJson>m__1() (at Z:/tmp/tmp.DPw5MV1I7c/firebase/app/client/unity/editor/src/GenerateXmlFromGoogleServicesJson.cs:103)

    Google.<InitializeOnMainThread>c__AnonStorey0:<>m__0() (at Z:/tmp/tmp.Ujmedx6O9O/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/EditorInitializer.cs:60)

    Google.RunOnMainThread:ExecutePollingJobs() (at Z:/tmp/tmp.Ujmedx6O9O/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:409)

    Google.RunOnMainThread:<ExecuteAllUnnested>m__1() (at Z:/tmp/tmp.Ujmedx6O9O/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:541)

    Google.RunOnMainThread:RunAction(Action) (at Z:/tmp/tmp.Ujmedx6O9O/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:343)

    Google.RunOnMainThread:ExecuteAllUnnested(Boolean) (at Z:/tmp/tmp.Ujmedx6O9O/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:530)

    Google.RunOnMainThread:ExecuteAll() (at Z:/tmp/tmp.Ujmedx6O9O/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:512)

    UnityEditor.EditorApplication:Internal_CallUpdateFunctions() (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorApplication.cs:332)

    This is the post in the GitHub page:
    https://github.com/firebase/quickstart-unity/issues/892

    I would appreciate some help. Getting pretty desperate, I've been on this all day long.
     
    leni8ec and planetfactory like this.
  2. Endahs

    Endahs

    Joined:
    Sep 16, 2014
    Posts:
    94
    I'm getting the same error. Some searching online says that if you create a Realtime Database (under the Build section) in your Firebase console that it can work. But this is not part of any of the Firebase Unity tutorials.

    Friends who are developing on other platforms who are using Crashlytics + Google Analytics services as part of Firebase do NOT have to create a Realtime Database.

    https://github.com/firebase/quickstart-unity/issues/892
     
    leni8ec, p0w1nd, xjjon and 2 others like this.
  3. Endahs

    Endahs

    Joined:
    Sep 16, 2014
    Posts:
    94
    So I created a Realtime Database, set it to have no read/write privileges (it's one of the default options), regenerated the google-services.json file, and... it worked.

    Sounds like a bug, but at least this is a workaround. Since the Realtime Database can't be written to it should not bill you anything, but it's pretty silly.
     
    p0w1nd, Zamaroht, leni8ec and 2 others like this.
  4. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    You should be setting up the project on Firebase as a Unity project which will include both the files required for Android and iOS. Do you have both files in your Assets folder in your project? These files are also used for PC builds, which I think it uses the Android one if you're doing PC.

    Also, make sure your Firebase packages are up to date. 7.0.1 is the latest version I'm showing. Any of the packages you use will all need to be on the same version.
     
  5. planetfactory

    planetfactory

    Joined:
    May 18, 2016
    Posts:
    56
    Great, that fixed my problem too. Thanks!
     
    morybest and Endahs like this.
  6. Nicokam

    Nicokam

    Joined:
    May 28, 2020
    Posts:
    64
    @Endahs

    Thanks for linking my thread with the fix in the GitHub regarding this subject. I had forgotten to do so!
     
  7. leni8ec

    leni8ec

    Joined:
    May 23, 2013
    Posts:
    24
    pfay and marcosroque like this.
  8. marcosroque

    marcosroque

    Joined:
    Oct 31, 2016
    Posts:
    2
  9. Tortuap

    Tortuap

    Joined:
    Dec 4, 2013
    Posts:
    137
    As well as for me.