Firebase Database.unitypackage 在导入 Unity 时显示错误
Posted
技术标签:
【中文标题】Firebase Database.unitypackage 在导入 Unity 时显示错误【英文标题】:Firebase Database.unitypackage is showing errors when imported into Unity 【发布时间】:2017-06-05 14:50:05 【问题描述】:我将 Firebase
数据库统一包导入 Unity,它不断向我显示许多错误。
Unable to find dependency com.google.android.gms:play-services-base:10.2.4 in paths ($SDK\extras\android\m2repository, $SDK\extras\google\m2repository).
com.google.android.gms:play-services-base:10.2.4 was referenced by:
at System.Environment.get_StackTrace() in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Environment.cs:line 227
at Google.JarResolver.Dependency..ctor(System.String group, System.String artifact, System.String version, System.String[] packageIds, System.String[] repositories)
at Google.JarResolver.PlayServicesSupport.DependOn(System.String group, System.String artifact, System.String version, System.String[] packageIds, System.String[] repositories)
at System.Reflection.MonoMethod.InternalInvoke(System.Object , System.Object[] , System.Exception ByRef )
at System.Reflection.MonoMethod.Invoke(System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:line 222
at System.Reflection.MethodBase.Invoke(System.Object obj, System.Object[] parameters) in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:line 115
at Google.VersionHandler.InvokeMethod(System.Type type, System.Object objectInstance, System.String methodName, System.Object[] args, System.Collections.Generic.Dictionary`2 namedArgs)
at Google.VersionHandler.InvokeInstanceMethod(System.Object objectInstance, System.String methodName, System.Object[] args, System.Collections.Generic.Dictionary`2 namedArgs)
at FirebaseAppDeps.SetupDeps() in C:\Users\Public\Documents\Unity Projects\WHOT_2D\Assets\Firebase\Editor\AppDeps.cs:line 52
at FirebaseAppDeps..cctor() in C:\Users\Public\Documents\Unity Projects\WHOT_2D\Assets\Firebase\Editor\AppDeps.cs:line 23
at System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(IntPtr )
at System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(RuntimeTypeHandle type) in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs:line 101
at UnityEditor.EditorAssemblies.ProcessEditorInitializeOnLoad(System.Type type) in C:\buildslave\unity\build\Editor\Mono\EditorAssemblies.cs:line 136
at UnityEditor.EditorAssemblies.ProcessInitializeOnLoadAttributes() in C:\buildslave\unity\build\Editor\Mono\EditorAssemblies.cs:line 162
UnityEngine.Debug:LogError(Object)
GooglePlayServices.PlayServicesResolver:<PlayServicesResolver>m__0(String, LogLevel)
Google.JarResolver.PlayServicesSupport:Log(String, LogLevel, Boolean)
Google.JarResolver.PlayServicesSupport:FindCandidate(Dependency, List`1)
Google.JarResolver.PlayServicesSupport:LoadDependencies(Dictionary`2, List`1, Boolean, Boolean)
Google.JarResolver.PlayServicesSupport:LoadDependencies(Boolean, Boolean, Boolean)
Google.JarResolver.PlayServicesSupport:FindMissingDependencyPaths(String, Dictionary`2&, ExplodeAar)
GooglePlayServices.ResolverVer1_1:DoResolution(PlayServicesSupport, String, OverwriteConfirmation, Action)
GooglePlayServices.PlayServicesResolver:Resolve(Action)
GooglePlayServices.PlayServicesResolver:MenuResolve()
Unable to find dependency com.google.firebase:firebase-common:10.2.4 in paths ($SDK\extras\android\m2repository, $SDK\extras\google\m2repository).
Unable to find dependency com.google.firebase:firebase-auth:10.2.4 in paths ($SDK\extras\android\m2repository, $SDK\extras\google\m2repository).
No compatible versions of com.google.android.gms:play-services-base:10.2.4 found given the set of required dependencies.
No compatible versions of com.google.firebase:firebase-common:10.2.4 found given the set of required dependencies.
我尝试为 android 编译快速测试示例数据库游戏,但我得到“一个或多个 Firebase 依赖项不存在。当前依赖项状态:UnavailableOther”。 所以我尝试使用 Asserts > Play services Resolver > Android Resolver > Resolve Client Jars。它将打印回此错误列表。请帮帮我。
【问题讨论】:
打开您的 Android SDK 管理器并下载 Google Play 服务。它是 Firebase 依赖项之一。 我已经下载了 Google Play 服务和 Google Play 存储库。还是一样的。 【参考方案1】:Firebase 插件与许多其他插件一样,使用 Play services resolver 来解决所需的依赖关系。
从错误消息来看,解析器似乎无法找到它正在寻找的内容:
Unable to find dependency com.google.android.gms:play-services-base:10.2.4 in paths ($SDK\extras\android\m2repository, $SDK\extras\google\m2repository).
请注意,路径以 $SDK 开头,而不是真正的真实文件夹。
您应该确保您的 Android SDK 路径在 Unity 中的 Preferences -> External Tools 下正确设置。
另外,请确保您拥有最新版本的 Google Play 服务(通过 SDK 管理器,确保“Extras”下的内容是最新的)。
【讨论】:
以上是关于Firebase Database.unitypackage 在导入 Unity 时显示错误的主要内容,如果未能解决你的问题,请参考以下文章
无法解决:com.google.firebase:firebase-ml-vision:24.1.3;无法解决:com.google.firebase:firebase-core:20.0.2
没有创建 Firebase 应用“[DEFAULT]” - 在 Flutter 和 Firebase 中调用 Firebase.initializeApp()
如何修复 Firebase 9.0 导入错误? “尝试导入错误:‘firebase/app’不包含默认导出(导入为‘firebase’)。”