gradle同步失败,出现1条警告,请通过将google-services插件的版本更新为16.0.4来解决版本冲突

时间:2018-10-27 06:04:06

标签: android firebase android-studio-3.0

我尝试了所有可能的方法,但仍未同步,请帮助。以下是我的整个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'

下面是错误消息

请通过更新google-services插件的版本(有关最新版本的信息可从https://bintray.com/android/android-tools/com.google.gms.google-services/获得)或将com.google.android.gms的版本更新为16.0.4来解决版本冲突。

2 个答案:

答案 0 :(得分:0)

在您的项目 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

    }
}

答案 1 :(得分:0)

您正在使用不同版本的Firebase依赖项。那可能是失败的原因。将google-services更新到最新版本,并对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依赖项。