插件 [id: 'com.google.gms.google-services'] 无法找到

Plugin [id: 'com.google.gms.google-services'] was not found

提问人:Kumar Chandranshu 提问时间:11/10/2021 最后编辑:DeePanShuKumar Chandranshu 更新时间:4/2/2023 访问量:680

问:

当我尝试将云 Firestore SDK 添加到您的应用程序时,它显示错误。

错误:在此处输入图像描述

项目图片:在此处输入图片描述bulid.gradle

project.setting的图片:在此处输入图片描述

请帮帮我...

plugins {

    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'com.google.gms.google-services'
}

android {
    compileSdk 31

    defaultConfig {
        applicationId "com.example.faltu3"
        minSdk 16
        targetSdk 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
    implementation 'com.google.firebase:firebase-firestore:24.0.0'
    implementation 'com.android.support:support-annotations:28.0.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Android Firebase 云防火墙 android-gradle-plugin 谷歌播放服务

评论


答:

0赞 Zealous System 11/10/2021 #1

你需要在build.gradle(projectname)中放下面的依赖项 “ 类路径 'com.google.gms:google-services:4.3.10' ”

和 “apply plugin: 'com.google.gms.google-services' ” in build.gradle(:app)

enter image description here

0赞 Md. Arif 4/2/2023 #2

项目级别 build.gradle 文件中添加此行

plugins {
    id 'com.google.gms.google-services' version '4.3.15' apply false
}

将其添加到应用级 build.gradle 文件中

plugins {
    id 'com.google.gms.google-services'
}