gradle同步失败,出现1条警告.请通过将谷歌服务插件的版本更新到16.0.4来解决版本冲突



我尝试了所有可能的方法,但仍然没有同步,请帮忙。下面是我的整个gradle文件,我试图合并firebase核心和消息,但它仍然显示错误

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.google.firebase:firebase-storage:16.0.4'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.firebaseui:firebase-ui-database:1.1.1'
implementation 'id.zelory:compressor:2.1.0'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.github.arturogutierrez:badges:1.0.5@aar'
implementation 'com.github.broakenmedia:CharCountTextView:v1.0'
implementation 'com.github.broakenmedia:MultiContactPicker:1.8.3'
implementation 'com.github.lguipeng:BubbleView:1.0.1'
implementation 'com.rockerhieu.emojicon:library:1.3.3'
implementation 'com.android.support:cardview-v7:27.1.1'
}

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

以下是错误消息

请通过更新谷歌服务插件的版本来解决版本冲突(有关最新版本的信息,请访问https://bintray.com/android/android-tools/com.google.gms.google-services/)或者将com.google.android.gms的版本更新为16.0.4。

项目build.gradle文件中,替换为以下行:

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
compile 'com.google.gms:google-services:4.2.0'//the latest version is 4.2.0
}
}

您正在使用不同版本的firebase依赖项。这可能是失败的原因。将谷歌服务更新到最新版本,并对firebase依赖项使用相同版本。。

// as you can see different versions for firebase dependecies
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-database:16.0.4'

请使用16.0.4或最新版本的firebase依赖项。

最新更新