android - 找不到ID为 'com.google.gms.google-services'的插件打开文件

标签 android firebase gradle google-play-services build.gradle

I have followed this link with no success to solving the issue.

还有这个Plugin with id 'com.google.gms.google-services' not found

A Screen shot of the error displyed

这是我的build.gradle(Module:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.1"
    defaultConfig {
        applicationId "example.technerd.com.firebaseauthentication"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    implementation 'com.google.firebase:firebase-analytics:17.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

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

这是我的build.gradle(Project:ProjectName)
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        //google()
        google()  // Google's Maven repository
        jcenter()

    }
    dependencies {
       classpath 'com.android.tools.build:gradle:3.4.2'
      //  classpath 'com.google.gms:google-services:4.3.2'
       // classpath 'com.google.gms:google-services:4.3.2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
       // google()
        google()  // Google's Maven repository
        jcenter()

    }
}

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

我缺少什么或我添加了什么不正确的东西?
请帮助我解决这是我的错误。

最佳答案

检查official guide:

在您的顶级文件中,您必须添加google play服务插件com.google.gms:google-services:

buildscript {
    repositories {
        google()  
        jcenter()

    }
    dependencies {
       classpath 'com.android.tools.build:gradle:3.4.2'
       classpath 'com.google.gms:google-services:4.3.2'
    }
}

关于android - 找不到ID为 'com.google.gms.google-services'的插件打开文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58612293/

相关文章:

firebase - 如何获得从消防站到 flutter 的时间距离

android-studio - AndroidStudio 3.1.2 突然将导入显示为未解析

android - Android 应用程序中的 OAuth

gwt - Gradle(tomcat-plugin):tomcatRun无法执行GWT JS

android - Facebook android sdk 发送请求

java - 如何改进我的代码以更有效地从远程服务器加载图像而不出现 UI 延迟?

android - 使用 Itemtouchhelper 更改房间数据库的顺序

android - 如何从图库中选择图片?

firebase - 箭头键不适用于 firebase init 命令

javascript - 如何将Firebase数据显示在屏幕上