我正在尝试更新使用 GMS 库的旧项目。但是,Gradle 同步无法刷新项目,出现标题中提到的错误。
这就是 build.gradle 的样子:
project(":android") {
apply plugin: "android"
apply plugin: 'com.android.application'
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
compile "com.google.android.gms:play-services:7.0.0"
}
}
错误是:
Error:Could not find com.google.android.gms:play-services:7.0.0.
Searched in the following locations:
file:/C:/Users/Harri/.m2/repository/com/google/android/gms/play-services/7.0.0/play-services-7.0.0.pom
file:/C:/Users/Harri/.m2/repository/com/google/android/gms/play-services/7.0.0/play-services-7.0.0.jar
https://repo1.maven.org/maven2/com/google/android/gms/play-services/7.0.0/play-services-7.0.0.pom
https://repo1.maven.org/maven2/com/google/android/gms/play-services/7.0.0/play-services-7.0.0.jar
https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/7.0.0/play-services-7.0.0.pom
https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/7.0.0/play-services-7.0.0.jar
https://oss.sonatype.org/content/repositories/releases/com/google/android/gms/play-services/7.0.0/play-services-7.0.0.pom
https://oss.sonatype.org/content/repositories/releases/com/google/android/gms/play-services/7.0.0/play-services-7.0.0.jar
Required by:
CarGame-refresh:android:1.2
我已经在 SDK 管理器中安装并更新了所有必需的东西:
需要注意的是,这个项目原本是一个Eclipse项目,我刚刚导入到Android Studio中。
编辑:Gradle 看起来似乎不是 GMS 的正确目录。不过,它安装在 SDK 路径中。看来这里的问题和this unsolved question很相似.
最佳答案
事实证明,文档可能比官方提供的更先进。
compile 'com.google.android.gms:play-services:6.5.87'
似乎工作正常只是因为我执行了以下步骤:
打开模块设置(F12) -> 依赖选项卡 -> “+”号 -> 1) 库依赖 -> com.google.android.gms:play-services:6.5.87
关于android - 找不到 com.google.android.gms :play-services:7. 0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29191957/