排解常見錯誤

本頁面說明如何診斷及修正常見錯誤。系統會根據錯誤代碼和記錄訊息分成不同部分。

回應代碼 400

Connecting to: https://performanceparameters.googleapis.com/v1/applications/...
TuningFork:Web: Response code: 400
TuningFork:Web: Response message: Bad

如果您的 API 金鑰無效,則可能會收到這則錯誤訊息。請參閱啟用 API 和「設定外掛程式」一節。

回應代碼 403

TuningFork:Web: Connecting to: https://performanceparameters.googleapis.com/v1/applications/...:generateTuningParameters
TuningFork:Web: Response code: 403
TuningFork:Web: Response message: Forbidden

如果未啟用 API 金鑰,或對限制 API 金鑰時發生錯誤 (例如,使用的憑證或雜湊值有誤),則可能會收到這則錯誤訊息。請參閱啟用 API

記錄檔中顯示「No parameters: no fidelity parameters」警告和「java.lang.NoSuchFieldError」

TuningFork:FPDownload: No parameters: no fidelity parameters
TuningFork: java.lang.NoSuchFieldError: no "[Landroid/content/pm/ApplicationInfo;" field "applicationInfo" in class "Landroid/content/pm/PackageInfo;" or its superclasses
TuningFork: Could not get fidelity params from server : err = 4

這些是 Tuning Fork 程式庫在檢查應用程式是否設有可偵錯標記時發出的無害警告。儘管較為冗長,但這些做法無害,不代表程式庫的整合過程發生問題。您可以忽略這些警告

多個 Google.Protobuf.dll 檔案

PrecompiledAssemblyException: Multiple precompiled assemblies with the same name
Google.Protobuf.dll included for the current platform.
Only one assembly with the same name is allowed per platform. Assembly paths: ...

Error: The imported type `Google.Protobuf.IMessage<T>' is defined multiple times

如果專案包含多個 Google.Protobuf.dll 檔案,可能會出現其中一項錯誤。請移除其中一個 .dll 檔案,即可解決這項衝突。

嘗試呼叫方法…如果未產生預先 (AOT) 程式碼

ExecutionEngineException: Attempting to call method 'Google.Protobuf.Reflection.ReflectionUtil+ReflectionHelper' ... for which no ahead of time (AOT) code was generated.

您可以在某些版本的 Unity 中看到這項錯誤。如果 AOT 編譯器未產生一般方法的程式碼,就會發生這個錯誤。如要瞭解如何強制產生必要程式碼,請參閱「預先編譯 (AOT)」一節。

命名空間「Google」中沒有類型或命名空間名稱「Protobuf」

The type or namespace name `Protobuf' does not exist in the namespace `Google'. Are you missing an assembly reference?

請確認您的專案使用的是 .NET 4.x。依序勾選「Player Settings」>「Other Settings」>「Configuration」>「Scripting Runtime Version」

LoadingSceneTracker.cs:找不到類型或命名空間名稱「FidelityParams」

LoadingSceneTracker.cs: The type or namespace name 'FidelityParams' could not be found (are you missing a using directive or an assembly reference?)
LoadingSceneTracker.cs: The type or namespace name 'Annotation' could not be found (are you missing a using directive or an assembly reference?)

請依序前往「Player Settings」>「Scripting Define Symbols」並移除 ANDROID_PERFORMANCE_TUNER_UTILITIES