Gradle同步失败-找不到ID为'com.google.gms.google-play-services'的插件 [英] Gradle sync Failed - Plugin with id 'com.google.gms.google-play-services' not found

查看:345
本文介绍了Gradle同步失败-找不到ID为'com.google.gms.google-play-services'的插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将我的应用程序与firebase-console连接起来. 我按照指示一步一步来. 但是当我执行此步骤时,

i am trying to connect my app with firebase-console. i follow the instruction step by step. but when i follow this step,

"Gradle的Google服务插件包含您刚刚下载的google-services.json文件.更改您的build.grade文件以使用此插件."

"The Google services plugin for Gradle contains the google-services.json file you just downloaded. Change your build.grade file to use this plugin."

项目级build.gradle:

project-level build.gradle:

buildscript {
      dependencies {
        // Add this line
        classpath 'com.google.gms:google-services:3.1.0'
      }
    }

应用程序级build.gradle

app-level build.gradle

    ...
    // Add to the bottom of the file
    apply plugin: 'com.google.gms.google-services'

然后尝试同步,出现此错误

then trying to sync, i got this error

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

... 有人可以帮我解决这个问题吗? 这是我的代码.

... someone can help me fix this? this is my code now.

项目build.gradle

project build.gradle

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.google.gms:google-services:3.1.0'


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

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

app build.gradle

app build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.kreuzell.myapplicationss"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.google.android.gms:play-services-ads:11.4.2'
}

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

推荐答案

更改此内容:

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

对此:

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

这篇关于Gradle同步失败-找不到ID为'com.google.gms.google-play-services'的插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆