簡體   English   中英

更新到最新版本 4.3.7 后找不到 ID 為“com.google.gms.google-services”的插件

[英]Plugin with id 'com.google.gms.google-services' not found after updated to latest version 4.3.7

我已將我的 android 工作室更新到最新版本 4.2。 更新后,我更改了版本

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

到最新版本

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

現在它顯示了這個錯誤。

Caused by: org.gradle.api.plugins.UnknownPluginException: Plugin with id 'com.google.gms.google-services' not found.

build.gradle(項目級別):

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext {
        kotlin_version = '1.5.0'
    }
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.1'
        classpath 'com.google.gms:google-services:4.3.7'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

build.gradle(應用級別)

plugins {
    id 'com.android.application'
    id 'kotlin-android'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"


    defaultConfig {
        applicationId "com.netcom.netsmartapp"
        minSdkVersion 23
        targetSdkVersion 30
        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
    }
}

dependencies {
    implementation platform('com.google.firebase:firebase-bom:28.0.1')
    implementation 'com.google.firebase:firebase-auth'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
    implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'



}
apply plugin: 'com.google.gms.google-services' <--- This line shows error

錯誤指向 App Level Gradle 文件中的這一行

apply plugin: 'com.google.gms.google-services' <--- This line shows error

我不知道為什么會這樣。 我還更新了我的 firebase 庫。 盡管它不起作用。 請幫我解決一些問題。

使用 4.3.6 版本時崩潰:

com.android.build.gradle.internal.crash.ExternalApiUsageException: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method setVariantDir() for arguments [debug] on task ':app:processDebugGoogleServices' of type com.google.gms.googleservices.GoogleServicesTask

完整的崩潰日志: https://pastebin.com/Dpgm0jm7

更新到 4.3.8 解決了這個問題。

舊答案

我在嘗試升級時遇到了同樣的問題。 檢查 Google 插件的 Maven 存儲庫,它仍然是 4.3.5。 但是在Google 托管的 Maven 存儲庫中是 4.3.7。 谷歌托管 maven 上的說明說你需要添加

implementation("com.google.gms:google-services:4.3.7")

我沒有時間測試它,所以我恢復到 4.3.5,因為它工作得很好,直到谷歌修復問題或將 4.3.7 上傳到 Maven。 我建議你也這樣做,除非某些東西不起作用。

更新 1

@Markers 報告說更新到4.3.7 ,然后從build.gradle文件中的applyid中刪除插件定義是有效的,但 firebase 日志記錄等一些功能不起作用。

我還沒有測試過。 如果可行,請在評論中告訴我們!

更新 2

版本 4.3.8 已在 Maven 存儲庫中發布 我會更新,看看它是否能解決問題(原則上應該)。 如果是這樣,那將是那些想要從 4.3.5 升級的人的解決方案

我也遇到了版本 4.3.7 的問題,但是將 package 帶到 4.3.8 我能夠毫無問題地同步 gradle。

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

暫無
暫無

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

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