简体   繁体   English

应用插件错误:“ com.google.gsm.google-services”还添加了类路径“ com.google.gms:google-services:4.2.0”

[英]Error apply plugin: 'com.google.gsm.google-services' also added classpath 'com.google.gms:google-services:4.2.0'

I am using firebase real-time database. 我正在使用Firebase实时数据库。 when i want to sync gradle i get this error message: Plugin with id 'com.google.gsm.google-services' not found. 当我想同步gradle时,出现以下错误消息:找不到ID为'com.google.gsm.google-services'的插件。

I have already download google-services.json and add it to my app folder in project view and I already tried many classpathes include: 我已经下载了google-services.json并将其添加到项目视图中的我的应用程序文件夹中,并且我已经尝试了许多类路径,包括:

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

project gradle: 项目gradle:

{buildscript 
    repositories {
        google()
        jcenter()    
}
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'com.google.gms:google-services:4.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

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

and my module app is: 我的模块应用程序是:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.esppad.friendlychat2"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}


dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.github.bumptech.glide:glide:3.6.1'
    implementation 'com.google.firebase:firebase-database:19.0.0'

}
apply plugin: 'com.google.gsm.google-services'

apply plugin: 'com.google.gsm.google-services' must not be placed inside dependencies Apply插件:“ com.google.gsm.google-services”一定不能放在依赖项中

Add it after dependencies like below, 在如下所示的依赖项之后添加它,

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.github.bumptech.glide:glide:3.6.1'
implementation 'com.google.firebase:firebase-database:19.0.0'
}

apply plugin: 'com.google.gsm.google-services'

You have a typo in this line: apply plugin: 'com.google.gsm.google-services' it should be gms not gsm, like this: 您在此行中有一个错别字: apply plugin: 'com.google.gsm.google-services'它应该是gms而不是gsm,如下所示:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.esppad.friendlychat2"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}


dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.github.bumptech.glide:glide:3.6.1'
    implementation 'com.google.firebase:firebase-database:19.0.0'
}

apply plugin: 'com.google.gms.google-services'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:找不到com.google.gms:google-services:4.2.0 - Error: could not find com.google.gms:google-services:4.2.0 使用 com.google.gms 时出错:google-services: 4.3.4 - Error using com.google.gms: google-services: 4.3.4 错误:文件 google-services.json 丢失。 (因为 com.google.gms:google-services 从 4.2.0 更新到 4.3.0) - ERROR: File google-services.json is missing. (Since com.google.gms:google-services updated from 4.2.0 to 4.3.0) 错误:(33, 0) 找不到参数的方法 classpath() [com.google.gms:google-services:3.0.1] - Error:(33, 0) Could not find method classpath() for arguments [com.google.gms:google-services:3.0.1] 有什么办法可以从顶级项目gradle中删除“ classpath'com.google.gms:google-services:4.2.0”依赖项 - Is there any way to remove "classpath 'com.google.gms:google-services:4.2.0' dependency from top level project gradle Bitrise:无法解析配置“:classpath”的所有工件无法解析com.google.gms:google-services:4.2.0 - Bitrise: Could not resolve all artifacts for configuration ':classpath' Could not resolve com.google.gms:google-services:4.2.0 无法更新到com.google.gms:google-services:4.2.0 - Can't update to com.google.gms:google-services:4.2.0 无法解析 com.google.gms:google-services:4.3.3 - Could not resolve com.google.gms:google-services:4.3.3 找不到com.google.gms:google-services:9.0.0 - Could not find com.google.gms:google-services:9.0.0 找不到 com.google.gms:google-services:4.2.3 - Could not find com.google.gms:google-services:4.2.3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM