-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to read firebase options #677
Comments
Just for anyone else having this issue, The workaround is directly adding the sourceset to the mainTemplate.gradle. You do this by going to project settings//publishing settings//build checkmark custom main gradle template it will give you the location to the file then add this code to the file.
all together it should look like this as an example
Even though a workaround exist no mention of this issue is in any of the documentation for unity that ive seen. So im fairly positive its a bug. I'm not sure which versions this started in, I know for sure unity 2021.1.0b8, 2021.1.0b7, & 2021.1.0b6 are affected. |
Is there a way to put a local path into sourceSets? Putting a global path doesn't work for version control between multiple users. |
I'm not at my PC to test this but try
Lemme know if it works for you. I'm not a big gradle user. I dont mess with it much so theres probably better ways to do this. |
@Arcalise08 That worked great, thanks! |
Hi folks, I did noticed that FirebaseApp cannot be created in an Android build created from Unity 2020.1.0b10. I suspect there are some breaking change from Unity 2020 that stop packing We will look into. At the meantime, @Arcalise08 's suggestion to utilize mainTemplate.gradle looks good. Shawn |
@Arcalise08 Thanks for your solution, however I want to add that we need to add every file in Currently now I need to manually add file by file like this
Are there anyway we could specified whole folder, or wildcard, in the sourceSets setting? |
Theoretically you should be able to do
However, seems like Unity's gradle task "':unityLibrary:packageReleaseResources" would attempt to pack the meta files generated by Unity as well and results in an error like "google-services.xml.meta: Error: The file name must end with .xml" Before Unity offers a better way to exclude meta file in gradle build, you would need to add each .xml files. |
@chkuang-g I am not know about gradle language at all but is this possible?
|
not at my PC but I believe you can add the .meta filetype to the ignoreassetspattern
It may not work if anything in there relies on meta data. Trial and error is your best friend lol. I'll mess around with it in the morning and see what I come up with. |
I'm still having this issue... Using latest beta Unity 2020.1.0b12 And only firebase anylitics package in my project , have the google-services.json in my assets folder and regardless of what I have tried over the past week I keep getting. 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 Any help would be appreciated |
I documented this known issue and resolution here. https://firebase.google.com/docs/unity/setup#missing_firebase_android_config_file_in_unity_2020 Could you make sure you follow all these steps? I was able to fix the problem using our Analytics quickstart It is really odd that Unity no longer supports |
@chkuang-g Thank you for the Reply! for a bit of background. i'm using Im using: Firebase 6.15.0 only using FirebaseAnalytics.unitypackage Have Forced resolved multiple times. Other google services i have in the project I have on app start: I cannot log any events, app freezes when i do... Log cat shows the following on app start Attached is my mainTemplate.gradle (renamed to .txt to upload here) |
@chrisraz You need to remove the top line of your gradle
you also probably want to move the sourcesets into the android path instead of declaring android again. Stick it right under lintOptions is where i put it.
|
@Arcalise08 Thanks for reply... Yes i missed that. i had it that way before, but removed everything firebase and tried re-adding everything and missed the top comment. i just updated the mainTemplate to see attached (again added.txt to upload here) as you specified, ran the build on device... and still cant get it working. it has been driving me mad for the past 2 weeks :/ Logcat: new mainTemplate.gradle |
@chrisraz Did you verify that there is a google.services.xml at |
@chrisraz Actually wait, thats a different error. No longer missing google.services. that means this issue is fixed. you got other stuff going on. |
@Arcalise08 do you mean before building in Unity? if so no i DON'T have |
My understanding is that google-services transforms google.services.JSON to google.services.xml which is then packed by unity. the error ive specified is an error an issue with the way unity has started packing files in the newer version. Your talking about a different issue. I would start a fresh project and carefully follow the steps outlined on firebase for unity if you can replicate the issue then start a new issue. I can tell from your gradle your missing com.google.gms:google-services:3.0.0 though. so some step might have been missed? Not super sure but if you do start fresh make sure you follow the workaround here so you dont run into the same issue with it not being bundled correctly. EDIT: That is to say, if your missing |
THANK YOU @Arcalise08 i just created a fresh project, installed firebase, and its working! i initially had a project with unity2020.2.09alpha and downgraded to the 2020.1.012beta version to try get a hold of this firebase issue... and maybe thats where things got messed up. Now the part of exporting and reimporting all the files as a package from the old project.... but thank you again its working :) |
Bumping this thread as this issue seems to have regressed in 2020.1.0f1 Have built release APKs using this workaround in 2020.1.0b12 , and it works just fine. Pointing Unity Cloud Build at the same commit and upgrading to 2020.1.0f1 causes the build to fail at the gradle stage after exporting the Unity project. It also fails on my local machine. Easy repro:
Partial error log:
This is a strange error since the resolver adds these lines to mainTemplate.gradle
so perhaps the gradle templates are being parsed / merged differently in the latest Unity? I had a go at debugging but my gradle skills are non-existent... |
Hi folks, I think Unity definitely changed the generated gradle project. There might be some thing EDM4U need to adapt for the new gradle project structure. while still supporting Unity 2019 and below. I'll have the team to really look into this and sort out all the change made in Unity 2020. @russ-smith Seems like There are a couple of options for the workaround
Sorry for the inconvenience. Shawn |
Is there likely to be a patch for this soon? Just want to know before I start looking into implementing the workaround.
|
The team is currently looking into the issue with google-services.json and Jetifier in Unity 2020. |
That is awesome to hear! Thanks for keeping me posted. |
Hi folks, some updates. We found this breaking change in Unity 2020.
So a quick workaround for this issue is to rename Another issue I discovered is that Both fixes will be included in the next release. Also we are investigating the most generic way to fix the issue with Jetifier in Unity 2020 (googlesamples/unity-jar-resolver#360 (comment)) and will likely to be fixed from EDM4U side. Shawn |
Hi @chkuang-g |
Hi, google-services.json: Resource and asset merger: The file name must end with .xml I do have an XML file on D:\Dropbox\MyProjects2020\Learning\Unity\tryProjs\TryGoogleAnalyticsv001\Assets\Plugins\Android\Firebase.androidlib\res\values How to handle this issue? Shefy |
Did you put If so, just move it out of of |
Hi all, one quick question, after renaming the folder to have the extension ".androidlib", Unity automatically creates another one without it (as if it was missing) and I keep getting errors. Any ideas on what should we do to avoid this from happening? |
Yes, Firebase 6.15.2 will keep creating BTW, here is a blog post regarding all Android build issues in Unity 2020. Worth checking if you have done all the workarounds. Several notes:
|
Thanks @Arcalise08 , It was very helpful. |
I used this link to turn it into XML: |
First of all thank you for your quick reply, the error I was getting when building was that the configuration files that were supposed to be inside the Also, regarding your notes, I was indeed to also get rid of the gradle template, so far so good. Looking forward the new version. |
This fixes all issues. In mainTemplate add this to bottom of the file.
Then in project settings use Custom Gradle Template |
Hi folks, Here is a blog post regarding to all the issues in Unity 2020. All of these should be fixed in the next SDK release. |
Hi folks, The issue related to Jetifier and AndroidX is released from EDM4U side. You can install 1.2.159 unitypackage. And still brewing the next Firebase release. Will keep you all updated. |
This helped me to fix this issue. |
Hi folks, Good news. 6.16.0 is release and it should resolve ALL of the following issues:
That is, you should no longer need any workaround described in this blog post or this doc after you upgrade to 6.16.0. I'll close this issue for now. If the issue remains, please report a new bug using bug template |
Please fill in the following fields:
Unity editor version: 2020.1.0b8
Firebase Unity SDK version: 6.14
Source you installed the SDK (.unitypackage or Unity Package Manager): .unitypackage
Firebase plugins in use (Auth, Database, etc.): Auth and analytics
Additional SDKs you are using (Facebook, AdMob, etc.): none fresh project
Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows
Platform you are targeting (iOS, Android, and/or desktop): Android
Scripting Runtime (Mono, and/or IL2CPP): Mono
Please describe the issue here:
"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."
Error on deploy. google-services.json is in root assets in unity. Reproduced in fresh unity project.
Please answer the following, if applicable:
Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
Havent tried
What's the issue repro rate? (eg 100%, 1/5 etc)
Not sure.
The text was updated successfully, but these errors were encountered: