android - 无法找到依赖项 com.google.android.gms :play-services-ads-lite:[10. 2.4]

标签 android firebase google-play-services unity3d firebase-analytics

我将 Firebase Analytics 导入到我的 Unity 项目中。我在 Android SDK 管理器中更新了 Google Play 服务,以及一些包。当我尝试编译我的 Unity 项目时,出现以下错误:

1)

Unable to find dependency com.google.android.gms:play-services-ads-lite:[10.2.4] in paths ($SDK\extras\android\m2repository, $SDK\extras\google\m2repository, $SDK\extras\android\m2repository, $SDK\extras\google\m2repository).

com.google.android.gms:play-services-ads-lite:[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.GetDependencies(Google.JarResolver.Dependency dep, System.Collections.Generic.List`1 repoPaths)
   at Google.JarResolver.PlayServicesSupport.GetTransitiveDependencies(System.Collections.Generic.Dictionary`2 dependencies, System.Collections.Generic.List`1 repoPaths)
   at Google.JarResolver.PlayServicesSupport.FindMissingDependencyPaths(System.String destinationDirectory, System.Collections.Generic.Dictionary`2 ByRef dependencyPaths, Google.JarResolver.ExplodeAar explodeAar)
   at GooglePlayServices.ResolverVer1_1.DoResolution(Google.JarResolver.PlayServicesSupport svcSupport, System.String destinationDirectory, Google.JarResolver.OverwriteConfirmation handleOverwriteConfirmation, System.Action resolutionComplete)
   at GooglePlayServices.PlayServicesResolver.Resolve(System.Action resolutionComplete)
   at GooglePlayServices.PlayServicesResolver.AutoResolve()
   at UnityEditor.EditorApplication.Internal_CallUpdateFunctions() in C:\buildslave\unity\build\artifacts\generated\common\editor\EditorApplicationBindings.gen.cs:line 197

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:GetDependencies(Dependency, List`1)
Google.JarResolver.PlayServicesSupport:GetTransitiveDependencies(Dictionary`2, List`1)
Google.JarResolver.PlayServicesSupport:FindMissingDependencyPaths(String, Dictionary`2&, ExplodeAar)
GooglePlayServices.ResolverVer1_1:DoResolution(PlayServicesSupport, String, OverwriteConfirmation, Action)
GooglePlayServices.PlayServicesResolver:Resolve(Action)
GooglePlayServices.PlayServicesResolver:AutoResolve()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

2)

ResolutionException: Cannot find candidate artifact for com.google.android.gms:play-services-ads-lite:[10.2.4]
Google.JarResolver.PlayServicesSupport.GetDependencies (Google.JarResolver.Dependency dep, System.Collections.Generic.List`1 repoPaths)
Google.JarResolver.PlayServicesSupport.GetTransitiveDependencies (System.Collections.Generic.Dictionary`2 dependencies, System.Collections.Generic.List`1 repoPaths)
Google.JarResolver.PlayServicesSupport.FindMissingDependencyPaths (System.String destinationDirectory, System.Collections.Generic.Dictionary`2& dependencyPaths, Google.JarResolver.ExplodeAar explodeAar)
GooglePlayServices.ResolverVer1_1.DoResolution (Google.JarResolver.PlayServicesSupport svcSupport, System.String destinationDirectory, Google.JarResolver.OverwriteConfirmation handleOverwriteConfirmation, System.Action resolutionComplete)
GooglePlayServices.PlayServicesResolver.Resolve (System.Action resolutionComplete)
GooglePlayServices.PlayServicesResolver.AutoResolve ()
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorApplicationBindings.gen.cs:197)

当我转到 Assets > Play Services Resolver > Android Resolver > Resolve Client Jars 时,我遇到了同样的错误。

我应该怎么做才能消除错误?

最佳答案

我想我已经解决了。

转到项目 Assets/GooglePlayGames/PluginVersion.cs 中的文件, 在内部将 PlayServicesVersionConstraint 更改为“10.2.1”(默认值为“10+”)。

保存并去统一。

在菜单中转到“ Assets ”>“Play 服务解析器”>“Android 解析器”>“解析客户端 Jar”。如果程序询问您有关版本更改的信息,请按确定。 该应用程序应该可以正常工作。

PS:抱歉我的英语太差了:( .

关于android - 无法找到依赖项 com.google.android.gms :play-services-ads-lite:[10. 2.4],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43755994/

相关文章:

angular - 如何直接从您的 Angular 项目中调用 Firebase Cloud Function

android - 发布已签名的 Android 应用程序,Google Plus 登录和 Google map 无法正常工作

android - 哪个 com.google.android.gms :play-services-ads version is compatible with com. android.support :appcompat-v7:27. 1.1?

android - 从 StartActivityForResult 打开相同的 Activity 返回

android - 想要以编程方式在联系人中创建一个新组

android - 带有参数 adjustViewBounds Android studio 的图像底部按钮

android - 桌面游戏上的 Google Play 游戏服务

android - 从 Assets 中读取 HTML 文件

android - Android Studio 中的几个 Gradle 错误

firebase - 如何限制 Firebase Firestore 集合中的文档