Firebase Database.unitypackage在导入Unity时显示错误

时间:2017-06-05 14:50:05

标签: firebase unity3d firebase-realtime-database

我将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&gt;播放服务解析器&gt; Android解析器&gt;解析客户端jar。它将打印回这个错误列表。请帮帮我。

1 个答案:

答案 0 :(得分:0)

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开头,而不是实际的真实文件夹。

您应确保在“偏好设置”下的Unity中正确设置了Android SDK路径 - &gt;外部工具。

此外,请确保您拥有最新版本的Google Play服务(来自SDK管理器,请确保&#34; Extras&#34;下的内容是最新的。)