java - Android Studio 错误 : Plugin with id 'com.google.gms.google-services' not found

标签 java android firebase android-studio

我是 Android 开发的新手。我在这个项目中使用 Firebase,但在 gradle:build 期间出现此错误

Plugin with id 'com.google.gms.google-services' not found.


这是我的 build.gradle 文件:
    apply plugin: 'com.android.application'
    apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.health.healthbloom"
        minSdkVersion 17
        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.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'com.google.firebase:firebase-database:19.5.1'
    implementation 'com.google.firebase:firebase-auth:20.0.1'
    implementation 'com.android.support:support-annotations:28.0.0'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.21'
    implementation 'com.hbb20:ccp:2.3.1'
    implementation 'com.chaos.view:pinview:1.4.3'

}
我也尝试在依赖项中添加它:-

classpath 'com.google.gms:google-services:3.0.0'

最佳答案

尝试将其添加到您的 build.gradle 依赖项中:

classpath 'com.google.gms:google-services:4.3.4'
另外,删除
apply plugin:'com.google.gms.google-services'
从您的项目/build.gradle 并将其添加到您的 app/build.gradle。
您也可以在这里查看更多信息 https://firebase.google.com/docs/android/setup#manually_add_firebase

关于java - Android Studio 错误 : Plugin with id 'com.google.gms.google-services' not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64858522/

相关文章:

java - Firebase 动态链接在安装后首次启动时不会调用动态链接

java - 从 EntityManager 返回部分实体

java - 在 Fragment 中使用 MainActivity 的值

java - 如何在节点Firebase中获得唯一的随机产品?

android - 安装时将图像存储在应用程序数据文件夹中

android - 谷歌地图无法添加对 Play 服务的引用

node.js - 如何在没有网络的情况下安装 Node.js 包?

java - 泽西 bean 验证 : Unable to initialize 'jakarta.el.ExpressionFactory'

java - 无法使用 IDEA 中的依赖链调试测试

java - LocalContainerEntityManagerFactoryBean 无法加载 JDBC 驱动程序类 'org.h2.Driver' 无法构建 Hibernate SessionFactory