Android studio Android Gradle未能解决此问题

Android studio Android Gradle未能解决此问题,android-studio,android-gradle-plugin,Android Studio,Android Gradle Plugin,我在gradle文件中遇到此错误: apply plugin: 'com.android.application' buildscript { repositories { mavenCentral() } dependencies { classpath 'com.google.gms:google-services:3.0.0' } } android { compileSdkVersion 25

我在gradle文件中遇到此错误:

apply plugin: 'com.android.application'    

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.google.gms:google-services:3.0.0'
    }
}



android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    compileOptions {
        encoding "UTF-8"
    }


    lintOptions {
        disable 'MissingTranslation'
        abortOnError false
    }

    defaultConfig {
        applicationId "xxx.yyy.zzz"
        minSdkVersion 9
        targetSdkVersion 25
        versionCode 120
        versionName "1.20"
        multiDexEnabled true
        //Enabling multi dex support due to exceeding the 65K methods dex limit imposed by Android: http://stackoverflow.com/questions/29756188/java-finished-with-non-zero-exit-value-2-android-gradle
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            applicationVariants.all { variant ->
                variant.outputs.each { output ->
                    def formattedDate = new Date().format('yyyyMMddHHmmss')
                    def newName = output.outputFile.name
                    newName = newName.replace("app-", "MyAppName") 
                    newName = newName.replace("-release", "-release" + formattedDate)
                    //noinspection GroovyAssignabilityCheck
                    output.outputFile = new File(output.outputFile.parent, newName)
                }
            }
        }

    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':simple-crop-image-lib')

    compile 'com.google.firebase:firebase-core:9.6.1'
    compile 'com.google.firebase:firebase-messaging:10.2.4'
    compile 'com.google.android.gms:play-services:10.2.4' //8.3.0'    10.2.4'  9.0.0' 9.6.0'

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:mediarouter-v7:25.3.1'
    compile 'de.hdodenhof:circleimageview:1.3.0'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'

    //For soap:
    compile files('libs/ksoap2-android-assembly-2.5.8-jar-with-dependencies.jar')

}

apply plugin: 'com.google.gms.google-services'
错误:未能解析:com.google.android.gms:play services度量值:10.2.4

-安装存储库和同步项目

-打开文件

-在“项目结构”对话框中显示

但我的应用程序中没有使用play services度量。 另一方面,如果我单击“安装存储库和同步项目”链接,什么也不会发生。 有人能帮我吗?我在这个问题上浪费了好几天时间

这是我的完整gradle文件:

apply plugin: 'com.android.application'    

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.google.gms:google-services:3.0.0'
    }
}



android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    compileOptions {
        encoding "UTF-8"
    }


    lintOptions {
        disable 'MissingTranslation'
        abortOnError false
    }

    defaultConfig {
        applicationId "xxx.yyy.zzz"
        minSdkVersion 9
        targetSdkVersion 25
        versionCode 120
        versionName "1.20"
        multiDexEnabled true
        //Enabling multi dex support due to exceeding the 65K methods dex limit imposed by Android: http://stackoverflow.com/questions/29756188/java-finished-with-non-zero-exit-value-2-android-gradle
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            applicationVariants.all { variant ->
                variant.outputs.each { output ->
                    def formattedDate = new Date().format('yyyyMMddHHmmss')
                    def newName = output.outputFile.name
                    newName = newName.replace("app-", "MyAppName") 
                    newName = newName.replace("-release", "-release" + formattedDate)
                    //noinspection GroovyAssignabilityCheck
                    output.outputFile = new File(output.outputFile.parent, newName)
                }
            }
        }

    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':simple-crop-image-lib')

    compile 'com.google.firebase:firebase-core:9.6.1'
    compile 'com.google.firebase:firebase-messaging:10.2.4'
    compile 'com.google.android.gms:play-services:10.2.4' //8.3.0'    10.2.4'  9.0.0' 9.6.0'

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:mediarouter-v7:25.3.1'
    compile 'de.hdodenhof:circleimageview:1.3.0'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'

    //For soap:
    compile files('libs/ksoap2-android-assembly-2.5.8-jar-with-dependencies.jar')

}

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

在Android SDK中更新Google存储库。适用于我的47版

从firebase:


对于我来说,从“app build.gradle”中删除这些行:

并将这些添加到“project build.gradle”:


很高兴知道,这在官方文件中不存在
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.google.gms:google-services:3.0.0'
    }
}
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.1'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}