谷歌地图和Firebase安卓插件依赖性冲突

时间:2018-06-09 09:03:58

标签: android google-maps firebase

我正在处理Android应用程序,我在Google地图和Firebase上工作。我在我的gradle文件中添加了最新的链接,但它在GoogleMaps gradle链接上给出了一个红线错误。

错误:

  

所有gms / firebase库必须使用完全相同的版本规范(mixinb版本可能会导致运行时出现问题)。找到版本16.0.0,15.0.4,15.0.1。示例包括com.google.firbase:firebase-analytics:16.0.0和com.google.android.gms:play-services-measurement-base:15.0.4

摇篮:

dependencies{
    compile 'com.google.android.gms:play-services-maps:15.0.1'
    compile 'com.google.android.gms:play-services-location:15.0.1'
    compile 'com.google.firebase:firebase-core:16.0.0'
}

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

3 个答案:

答案 0 :(得分:0)

让你的播放服务依赖版本相同,并尝试下面的

dependencies{
    compile 'com.google.android.gms:play-services-maps:16.0.0'
    compile 'com.google.android.gms:play-services-location:16.0.0'
    compile 'com.google.firebase:firebase-core:16.0.0'
}

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

答案 1 :(得分:0)

还需要添加两个依赖项。我写的所有依赖项都在下面提到。

compile 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
compile 'com.google.firebase:firebase-core:15.0.1'
compile 'com.google.firebase:firebase-analytics:15.0.1'
compile ' com.google.android.gms:play-services-measurement-base:15.0.4'

答案 2 :(得分:0)

我与Android SDK API 28完美结合 gradle中没有任何错误enter image description here

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.myapp.app"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:support-v4:28.0.0-rc01'
    implementation 'com.android.support:design:28.0.0-rc01'
    implementation 'com.google.android.gms:play-services-maps:11.8.0'
    implementation 'com.github.medyo:android-about-page:1.2.4'
    implementation 'com.google.firebase:firebase-messaging:11.8.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'
}

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