Столкновение зависимости между play-services-map и firebase - PullRequest
0 голосов
/ 01 июня 2018

Я пытаюсь добавить firebase в проект, который я уже запустил, но в build.gradle (приложение) у меня возникла коллизия зависимостей между play-services-maps и firebase, я посмотрел везде и попытался изменить номер версии, нодо сих пор не работает.вот файл build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.android.tencho.test"
        minSdkVersion 22
        targetSdkVersion 26
        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:26.1.0'
    implementation 'com.google.android.gms:play-services:15.0.1'
//    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.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.android.support:design:26.1.0'
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    compile 'com.google.code.gson:gson:2.2.+'
    compile 'com.google.firebase:firebase-core:16.0.0'

//    //Firebase Auth
    implementation 'com.google.firebase:firebase-auth:16.0.1'
//    //FirebaseUI Auth
    compile 'com.firebaseui:firebase-ui-auth:3.3.0'


}

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

Build.gradle (уровень проекта)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

//        The google-services plugin has 2 main functions:
//        1) Process the google-services.json file and produce Android resources that can be used in your
//        application's code
//        2) Add dependencies for basic libraries required for the services you have enabled. This step requires
//        that the apply plugin: 'com.google.gms.google-services' line be at the bottom of your app/build.gradle file
//        so that no dependency collisions are introduced.
        classpath 'com.google.gms:google-services:4.0.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

1 Ответ

0 голосов
/ 01 июня 2018

Вы используете несовместимую версию.

Позвольте мне рассказать вам простой пример.

Если вы используете сервисы Google Play 11.8.0, то Firebase также должен быть в той же версии.

compile 'com.google.android.gms:play-services:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.android.gms:play-services-maps:11.8.0'
compile 'com.google.firebase:firebase-crash:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'

Итак, главное, что вы используете несовместимые версии,

...