其他分享
首页 > 其他分享> > unity 导入Firebase出现的坑

unity 导入Firebase出现的坑

作者:互联网


最近公司项目需要接入google的firebase sdk,来更好的分析用户行为。接入流程到firebase官网选择unity项目按照流程走就好了。接入完后出现了几个错误

错误一

Generation of the Firebase Android resource file google-services.xml from Assets/google-services.json failed.
If you have not included a valid Firebase Android resources in your app it will fail to initialize.
`F:/unity/50_Shopping_Island/../Assets/Firebase/Editor/generate_xml_from_google_services_json.exe -i "Assets/google-services.json" -l`.
Error loading Python DLL: C:\Users\ftb\AppData\Local\Temp\_MEI59722\python27.dll (error code 14001)

说是firebase初始化失败了,因为下载Python DLL失败。在网上查了一圈,似乎是因为win7系统和python版本的问题。最后找到了一个很好的解决方案。用pyinstaller重建generate_xml_from_google_services_json.py脚本。

解决步骤

pyinstaller --clean --win-private-assemblies -F generate_xml_from_google_services_json.py

错误二

如果按照官方流程的话,可能还会出现一个错误,无法找到google-services.json文件中的一个字段。

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.

解决方法:

1.在firebase面板中创建一个Realtime Database.

2.重新下载google-services文件,替换原来Asset文件下的google-services文件




最后文件中会多出一个firebase_url文件的配置,报错就解决了

标签:xml,google,Assets,导入,json,unity,Firebase,services
来源: https://www.cnblogs.com/xiemingxin/p/15505335.html