【问题标题】:Plugin with id 'com.google.gms.google-services' not found Open File未找到 ID 为“com.google.gms.google-services”的插件 打开文件
【发布时间】:2020-02-24 23:31:42
【问题描述】:

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
}

我遗漏了什么或添加了什么不正确的内容? 请帮我解决这是我的错误。

【问题讨论】:

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


【解决方案1】:

查看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'
    }
}

【讨论】:

  • 嗨@KamauMbugua。如果这个或任何答案已经解决了您的问题,请点击复选标记考虑accepting it。这向更广泛的社区表明您已经找到了解决方案,并为回答者和您自己提供了一些声誉。没有义务这样做。
猜你喜欢
  • 2017-02-14
  • 2021-12-22
  • 1970-01-01
  • 2021-02-27
  • 2020-12-08
  • 2022-09-20
  • 2018-04-19
  • 1970-01-01
相关资源
最近更新 更多