Gradle 应用插件:com.google.gms.google-服务

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

当我试图将 apply plugin: 'com.google.gms.google-services' 放在我的构建 gradle 或我的应用构建 gradle 中的其他任何地方时,我收到一条错误消息说它可以没找到。

Error:(70, 0) Plugin with id 'com.google.gms.google-services' not found.

这是我的 gradle 代码,所以你们可以帮我找出放置代码的位置。

apply plugin: 'com.android.application'


android {
    compileSdkVersion 24
    buildToolsVersion '24.0.3'

    defaultConfig {
        applicationId "com.technologx.blaze.player"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 101
        versionName "1.0 beta 1"
        //renderscript support mode is not supported for 21+ with gradle version 2.0
        renderscriptTargetApi 20
        renderscriptSupportModeEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            ext.enableCrashlytics = false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        disable 'MissingTranslation'
        disable 'ExtraTranslation'
    }

}

repositories {
    jcenter()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:recyclerview-v7:24.2.1'
    compile 'com.android.support:cardview-v7:24.2.1'
    compile 'com.android.support:palette-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    compile 'com.android.support:percent:24.2.1'

    compile 'com.google.android.gms:play-services-ads:8.4.0'
    compile 'com.google.firebase:firebase-ads:10.0.1'

    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
    compile 'net.steamcrafted:materialiconlib:1.0.3'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.3.0'
    compile 'com.squareup.okhttp:okhttp:2.3.0'
    compile 'com.google.code.gson:gson:2.3'
    compile 'de.Maxr1998:track-selector-lib:1.1'

    compile 'com.afollestad.material-dialogs:core:0.9.0.2'
    compile 'com.afollestad.material-dialogs:commons:0.9.0.2'

    compile 'com.anjlab.android.iab.v3:library:1.0.+'

    compile('com.github.naman14:app-theme-engine:0.5.2@aar') {
        transitive = true
    }
}

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

我想你的项目中也需要这个 gradle 文件:

buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.0.0'
    }
}