错误:修复版本冲突(谷歌播放服务)Kotlin

时间:2018-06-02 15:28:01

标签: android firebase google-play-services

根据此SO主题,我知道存在版本冲突,但在Google发布新版本后问题仍然存在。

  

错误:请通过更新google-services插件的版本(https://bintray.com/android/android-tools/com.google.gms.google-services/提供有关最新版本的信息)或将com.google.android.gms的版本更新为12.0来修复版本冲突0.1。

我的 build.gradle(模块:应用)

....
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.google.firebase:firebase-core:11.8.0'
    implementation 'com.google.firebase:firebase-auth:11.6.0'
    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'
    compile 'com.google.android.gms:play-services:12.0.1'
}

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

现在需要进行哪些更改?

1 个答案:

答案 0 :(得分:0)

您必须使用implementation代替compile

使用这个gradle库,我已经在我的电脑上查了一下。

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.41"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-auth:15.0.0'
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.google.android.gms:play-services:12.0.1'

同样在项目级别 build.gradle添加存储库:

repositories {
maven{
    url "https://maven.google.com"
}
    google()
    jcenter()
}

检查屏幕截图以便更好地理解:

enter image description here