首页 文章

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

提问于
浏览
2

根据这个SO线程,我知道存在版本冲突,但是在谷歌的新版本之后问题仍然存在 .

错误:请通过更新google-services插件的版本来修复版本冲突(有关最新版本的信息,请访问https://bintray.com/android/android-tools/com.google.gms.google-服务/)或将com.google.android.gms的版本更新为12.0.1 .

我的 build.gradle(Module: app)

....
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'

What changes are required now?

1 回答

  • 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'
    

    另外在 Project level build.gradle 添加存储库:

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

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

    enter image description here

相关问题