错误:找不到com.google.android.gms:play-services:10.2.0

时间:2017-03-09 21:07:41

标签: android gradle admob google-play-services

我已经使用admob导入了一个procject但是现在无法编译我的项目因为这个错误.. 我试图添加所有我的gradle dependecies但发生同样的错误

Error:Could not find com.google.android.gms:play-services:10.2.0.
Searched in the following locations:
    file:/D:/AndroidStudio/AndroidStudio/gradle/m2repository/com/google/android/gms/play-services/10.2.0/play-services-10.2.0.pom
    file:/D:/AndroidStudio/AndroidStudio/gradle/m2repository/com/google/android/gms/play-services/10.2.0/play-services-10.2.0.jar
    https://repo1.maven.org/maven2/com/google/android/gms/play-services/10.2.0/play-services-10.2.0.pom
    https://repo1.maven.org/maven2/com/google/android/gms/play-services/10.2.0/play-services-10.2.0.jar
    https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/10.2.0/play-services-10.2.0.pom
    https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/10.2.0/play-services-10.2.0.jar
    https://oss.sonatype.org/content/repositories/releases/com/google/android/gms/play-services/10.2.0/play-services-10.2.0.pom
    https://oss.sonatype.org/content/repositories/releases/com/google/android/gms/play-services/10.2.0/play-services-10.2.0.jar
Required by:
    project :android > project :BaseGameUtils

这是我的build.gradle(BaseGamesUtils)

apply plugin: 'com.android.library'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.google.android.gms:play-services:10.2.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'
}

我也从这里删除并添加到build.gradle(模块:android)但在build.gradle(Project:MyProject)上的相同错误相同的任何帮助将非常appriciated,我现在花3天时间为此误差..

我看到了:

  

文件:/ d:/ AndroidStudio / AndroidStudio / gradle这个/ m2repository / COM /谷歌/机器人/克/播放服务/   甚至不存在..项目正在那里......

所有内容都像sdk和gradle一样更新为3.3但没有任何帮助...

1 个答案:

答案 0 :(得分:0)

我想知道Abhishek Aryan的问题和堆栈溢出中发现的另一个问题,并改变了maven寻找存储库的位置..

我在存储库中添加了以下两行:

    maven { url "D:/AndroidStudio/AndroidStudioSDK/sdk/extras/android/m2repository" }
    maven { url "D:/AndroidStudio/AndroidStudioSDK/sdk/extras/google/m2repository" }

所以我的总数是:

 repositories {
        maven { url "D:/AndroidStudio/AndroidStudioSDK/sdk/extras/android/m2repository" }
        maven { url "D:/AndroidStudio/AndroidStudioSDK/sdk/extras/google/m2repository" }
        mavenCentral()
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
        maven { url 'https://oss.sonatype.org/content/repositories/releases/' }

最后一周后,xD并感谢你们的时间和帮助:)