Gradle 找不到 google play 依赖项 [英] Gradle can not find google play dependency
问题描述
我尝试在我的 android 项目中修复对 google play 服务的依赖.它已经工作了,但现在它坏了.我认为这发生在 Android Studio 测试版和发布版之间.
I try to repair the dependency to google play services in my android project. It already worked but now it is broken. I think this happened in between the Android Studio beta- and release-version.
这是build.gradle文件中的依赖:
This is the dependency in the build.gradle file:
dependencies {
compile 'com.google.android.gms:play-services:6.5.87'
}
Android Studio 能够自动完成版本字符串:'6.5.87' 所以我认为它知道如何解决依赖关系.但它没有..这就是我特里德:
Android Studio was able to autocomplete the version string: '6.5.87' So I thought it knows how to solve the dependency. But it does not.. This is what I treid:
- 重新安装了 Android Studio (1.0.1) 和 Android SDK
- 使用了多个播放服务版本(包括尝试使用+")
- 尝试对项目进行gradlew清理"
- 从 Android SDK 管理器安装了几乎所有东西.(包括 Google 存储库和 Android 支持存储库)
- 将所有环境变量设置为正确的路径
但是如果我尝试进行 gradle 项目同步,我仍然会收到此错误:
But I still get this error if I try to do a gradle project sync:
错误:找不到 com.google.android.gms:play-services:6.5.87.在以下位置搜索:文件:/C:/Users/MyName/.m2/repository/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom文件:/C:/Users/MaName/.m2/repository/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jarhttps://repo1.maven.org/maven2/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pomhttps://repo1.maven.org/maven2/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jarhttps://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pomhttps://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jarhttps://oss.sonatype.org/content/repositories/releases/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pomhttps://oss.sonatype.org/content/repositories/releases/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar要求:代码:安卓:1.0
Error:Could not find com.google.android.gms:play-services:6.5.87. Searched in the following locations: file:/C:/Users/MyName/.m2/repository/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom file:/C:/Users/MaName/.m2/repository/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar https://repo1.maven.org/maven2/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom https://repo1.maven.org/maven2/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar https://oss.sonatype.org/content/repositories/releases/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom https://oss.sonatype.org/content/repositories/releases/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar Required by: code:android:1.0
更新:
Gradle 正在file:/C:/Users/MyName/.m2/repository/"中搜索,但它应该使用"file:/C:/Users/MyName/AppData\Local\Android\sdk\extras\google\m2repository" .. 我不知道为什么这是错误的以及如何解决它..
Gradle is searching in "file:/C:/Users/MyName/.m2/repository/" but it should use "file:/C:/Users/MyName/AppData\Local\Android\sdk\extras\google\m2repository" .. I dont know why this is wrong and how to fix it..
更新 2
我使用此解决方法修复了它:
I fixed it using this workaround:
repositories {
def androidHome = System.getenv("ANDROID_HOME")
maven { url "$androidHome/extras/android/m2repository/" }
maven { url "$androidHome/extras/google/m2repository/"}
}
但我对此并不满意.有人知道我的 gradle 有什么问题吗?
But I am not happy with it. Does anybody know whats wrong with my gradle?
推荐答案
在 Android SDK Manager 中下载Google Repository"
In Android SDK Manager download the "Google Repository"
这篇关于Gradle 找不到 google play 依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!