Gradle sync失败:找不到com.google.gms:google-services:3.0.0

时间:2016-11-24 11:53:11

标签: android android-studio gradle build

实施时我遇到问题

classpath'com.google.gms:google-services:3.0.0'

在build.gradle

这是我的错误

Gradle sync failed: Could not find com.google.gms:google-services:3.0.0.
       Searched in the following locations:
       file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/gms/google-services/3.0.0/google-services-3.0.0.pom
       file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/gms/google-services/3.0.0/google-services-3.0.0.jar
       https://maven.fabric.io/public/com/google/gms/google-services/3.0.0/google-services-3.0.0.pom
       https://maven.fabric.io/public/com/google/gms/google-services/3.0.0/google-services-3.0.0.jar
       http://jzaccone.github.io/SlidingMenu-aar/com/google/gms/google-services/3.0.0/google-services-3.0.0.pom
       http://jzaccone.github.io/SlidingMenu-aar/com/google/gms/google-services/3.0.0/google-services-3.0.0.jar

这是我的build.graddle代码

buildscript {
dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
    classpath 'com.google.gms:google-services:3.0.0'
}

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url 'http://jzaccone.github.io/SlidingMenu-aar' }
}

}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://jzaccone.github.io/SlidingMenu-aar' }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile 'com.jeremyfeinstein.slidingmenu:library:1.3@aar'
compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') { transitive = true; }
}

apply plugin: 'com.google.gms.google-services'

你知道为什么会这样吗?请帮我解决这个问题? 感谢

1 个答案:

答案 0 :(得分:1)

检查您的Android SDK& Android Studio中的工具控制台,请确保您已安装最新版本的Google Play服务。

像这样:http://image.prntscr.com/image/4c89a169609b47688c1cf05da3b7f515.png