【问题标题】:Gradle sync Failed - Plugin with id 'com.google.gms.google-play-services' not foundGradle 同步失败 - 未找到 ID 为“com.google.gms.google-play-services”的插件
【发布时间】:2018-04-19 16:31:45
【问题描述】:

我正在尝试将我的应用与 firebase-console 连接。 我一步一步地按照说明进行操作。 但是当我按照这一步,

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

项目级 build.gradle:

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

应用级 build.gradle

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

然后尝试同步,我收到了这个错误

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

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

项目构建.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
}

应用构建.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'

【问题讨论】:

    标签: android firebase gradle android-gradle-plugin


    【解决方案1】:

    改变这个:

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

    到这里:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-14
      • 2021-12-22
      • 1970-01-01
      • 1970-01-01
      • 2020-02-24
      • 2021-02-27
      • 1970-01-01
      相关资源
      最近更新 更多