簡體   English   中英

Android Studio 錯誤:未找到 ID 為“com.google.gms.google-services”的插件

[英]Android Studio Error : Plugin with id 'com.google.gms.google-services' not found

我是 Android 開發的新手。 我在這個項目中使用 Firebase,但在 gradle:build 期間出現此錯誤

未找到 ID 為“com.google.gms.google-services”的插件。

這是我的 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'

}

我也嘗試在依賴項中添加它:-

類路徑 '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

您可以簡單地從 firebase 中刪除所有實現,然后轉到“ Tools > Firebase並連接您需要的所有內容而不會頭疼

只需進行clean buildrebuild clean build它,否則invalidate cache and restart它會重新啟動您的android studio。

你可以發現在文件>無效緩存並重新啟動將在那里

將此添加到依賴項並沒有解決:

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

嘗試添加這個:

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

到根 build.gradle。 檢查Go To Setting > Android SDK > SDK Tools > Google Play Service

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM