Gradle Error:同步应用时出现Google服务错误

时间:2016-11-17 07:43:27

标签: android gradle google-api

我遇到了Google服务的问题。我想在我的应用中添加SIGN IN API,但由于以下错误,我无法同步应用:

    Error:Could not find com.google.gms:google-services:3.0.0.
Searched in the following locations:
    file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/google/gms/google-services/3.0.0/google-services-3.0.0.pom
    file:/C:/Program Files/Android/Android Studio/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
Required by:
    DelSnapUser-Dometics:app:unspecified

这是我的Gradle:

  buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public'}
    jcenter()
    mavenCentral()
}


android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.example.delsnap_user_domestic.delsnapuser_dometics"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.+'
    compile 'com.android.support:design:23.+'
}

请帮我解决...谢谢,感谢:)

1 个答案:

答案 0 :(得分:1)

更改

  buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

  buildscript {
    repositories {
        jcenter() // <-- Added
        maven { url 'https://maven.fabric.io/public' }
    }