[英]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.