Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I would like to setup Firebase in Unity 2020.1.14.

I downloaded the GoogleService-Info.plist into my assets folder and set up a project in the Firebase console.

But as soon as I import the FirebaseAnalytics 7.0 package I'm getting this error:

Generation of the Firebase Android resource file google-services.xml from Assets/GoogleService-Info.plist failed.
If you have not included a valid Firebase Android resources in your app it will fail to initialize.

"python" "/Users/joerg/Projekte/UnityTest/FirebaseTest2012042/Assets/Firebase/Editor/generate_xml_from_google_services_json.py" -i "Assets/GoogleService-Info.plist" -l --plist

Could not find key in plist file: [DATABASE_URL]

How do I set the [DATABASE_URL] in GoogleService-Info.plist?

Thanks Joerg

like image 915
JoergP Avatar asked Dec 04 '20 17:12

JoergP


People also ask

Is it possible to build an Android app without Firebase resources?

No google-services.json files found in your project so it is not possible to generate Firebase Android resources file google-services.xml. Building without Firebase Android resources (google-services.xml) will result in an app that will fail to initialize.

How to fix Firebase_url error in Unity Project?

Replace these files in you Unity project. (these files should be inside of the Assets folder, or if you've created a Data folder, then you can find them there.) In the newly generated files there is a "firebase_url":. Which was missing before. This should now fix this particular error message. Thanks for the detailed instructions.

What are the functions of unity in Firebase?

Some Basic functions of unity like changing scene, changing texts dynamically, etc.. 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.

How do I add Google services to a firebase project?

Click google-services.json. Add the GoogleService-Info.plist file to the project. Navigate to the Assets folder in the Project window. Drag the GoogleService-Info.plist downloaded from the Firebase console into the folder. NOTE: GoogleService-Info.plist can be placed anywhere under the Assets folder.


3 Answers

This was really frustrating. There is no mention on the original setup tutorial about this issue. I'm assuming more people are going to run in to this problem. So here is the solution:

  1. Go to Firebase Console
  2. Choose your project
  3. Go to "Realtime Database"
  4. Create Realtime Database

After database is created.

  1. Go to "Project Settings"
  2. Download google-services.json and GoogleService-Info.plist
  3. Replace these files in you Unity project. (these files should be inside of the Assets folder, or if you've created a Data folder, then you can find them there.)

In the newly generated files there is a "firebase_url":. Which was missing before. This should now fix this particular error message.

like image 150
iTouch Avatar answered Oct 23 '22 06:10

iTouch


Ok, I found the solution: I just had to setup a database in the Firebase Console and then the url is written to the plist file. This wasn't mentioned in the Google tutorial.

like image 35
JoergP Avatar answered Oct 23 '22 06:10

JoergP


Simple solution, just add those lines:

<key>DATABASE_URL</key>
<string>https://unexisting.fake.database.firebaseio.com</string>

p.s. I would not recommend enabling database service since it's paid. If for some reason, some plugin will attempt to use it in some way, you will be charged. The only reason I am not using those awesome paid services from Google is that they are only POST PAID without ability to set limit (except you wrote some complicated script yourself which will run in real time and will turn off services once you reach certain limit). There are lot of developers stories who woke up with 5-10k bills due to some error in script.

like image 37
Developer Avatar answered Oct 23 '22 08:10

Developer