Firebase Unity SDK 无法找到 Firebase Android 资源生成所需的命令行工具 python

etl*_*ing 9 android unity-game-engine firebase

我在使用 firebase sdk 8.7.0 打开 unity 时收到此错误。

Unable to find command line tool python required for Firebase Android resource generation.
python is required to generate the Firebase Android resource file google-services.xml from Assets/Firebase/GoogleService-Info.plist. Without Firebase Android resources, your app will fail to initialize.
python was distributed with each Firebase Unity SDK plugin, was it deleted?

System.ComponentModel.Win32Exception (0x80004005): ApplicationName='python', CommandLine='"/Users/xxx/Documents/unity-project/Assets/Firebase/Editor/generate_xml_from_google_services_json.py" -i "Assets/Firebase/GoogleService-Info.plist" -l --plist', CurrentDirectory='/Users/xxx/Documents/unity-project', Native error= mono-io-layer-error (2)
  at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x002dc] in <0463b2ef957545c0a51b42f372cd4fbb>:0 
  at System.Diagnostics.Process.Start () [0x0003a] in <0463b2ef957545c0a51b42f372cd4fbb>:0 
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
  at GooglePlayServices.CommandLine.RunViaShell (System.String toolPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] envVars, GooglePlayServices.CommandLine+IOHandler ioHandler, System.Boolean useShellExecution, System.Boolean stdoutRedirectionInShellMode) [0x002dc] in Z:\tmp\tmp.cvthQg1D2s\third_party\unity\unity_jar_resolver\source\AndroidResolver\src\CommandLine.cs:631 
  at GooglePlayServices.CommandLine.Run (System.String toolPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] envVars, GooglePlayServices.CommandLine+IOHandler ioHandler) [0x00000] in Z:\tmp\tmp.cvthQg1D2s\third_party\unity\unity_jar_resolver\source\AndroidResolver\src\CommandLine.cs:510 
  at Firebase.Editor.PythonExecutor.Run (System.Collections.Generic.IEnumerable`1[T] arguments, System.String workingDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] envVars, GooglePlayServices.CommandLine+IOHandler ioHandler) [0x00000] in Z:\tmp\tmp.dYyxJerQE9\firebase\app\client\unity\editor\src\PythonExecutor.cs:180 
  at Firebase.Editor.GenerateXmlFromGoogleServicesJson.RunResourceGenerator (System.Collections.Generic.IEnumerable`1[T] arguments, System.String inputPath, System.Boolean showCommandLine) [0x0001b] in Z:\tmp\tmp.dYyxJerQE9\firebase\app\client\unity\editor\src\GenerateXmlFromGoogleServicesJson.cs:521 
 #0 GetStacktrace(int)
 #1 DebugStringToFile(DebugStringToFileData const&)
 #2 DebugLogHandler_CUSTOM_Internal_Log(LogType, LogOption, ScriptingBackendNativeStringPtrOpaque*, ScriptingBackendNativeObjectPtrOpaque*)
 #3  (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
 #4  (Mono JIT Code) [Z:\tmp\tmp.dYyxJerQE9\firebase\app\client\unity\editor\src\GenerateXmlFromGoogleServicesJson.cs:407] Firebase.Editor.GenerateXmlFromGoogleServicesJson:ReadBundleIds (string)
Run Code Online (Sandbox Code Playgroud)

我尝试python "/Users/xxx/Documents/unity-project/Assets/Firebase/Editor/generate_xml_from_google_services_json.py" -i "Assets/Firebase/GoogleService-Info.plist" -l --plist在 shell 中运行,它成功输出了我的应用程序的包 IDcom.myapp.bundle

我也尝试过重新导入firebase sdk,重新启动unity,重新启动mac,但都没有解决问题。

我搜索了类似的问题,但不幸的是没有找到解决方案。

在出现此错误之前我做了一些操作:我将 macOS 升级到了最新的 Monterey 12.3。不确定这是否相关。

我希望得到一些帮助。变得非常绝望,我一整天都在做这个。

Dus*_*ein 10

这是由于 MacOS 12.3 删除了 Python2。不幸的是我目前没有任何解决方法。我尝试将 Python3 符号链接到 /usr/local/bin (确保它在您的 PATH 上)并且在终端中工作正常,但由于某种原因 Unity/Firebase 仍然无法访问它。我还尝试启动到恢复模式并禁用 SIP,但您仍然无法符号链接到 /usr/bin,因为它现在在蒙特利(我认为是大苏尔)是只读的。我对此问题添加了一些注释 - https://github.com/firebase/firebase-unity-sdk/issues/154,并且可能还会发布到 Unity 论坛/错误跟踪器,因为我不确定问题是否存在Firebase SDK 或 Unity 本身。

  • 嗨达斯汀,非常感谢您的评论!我将跟踪问题链接。幸运的是,构建仍然成功,即使显示错误,Firebase 也能正常工作,所以现在它只是一个错误垃圾邮件。不确定这是否会随着项目的新变化而打破 (2认同)