简体   繁体   中英

Error build gradle when creating firebase

I've tried to add firebase to my project, but I got stuck. Here is my build gradle project:

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

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

        classpath 'com.google.gms:google-services:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

And here is my build gradle module app:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"

    defaultConfig {
        applicationId "com.vlad.comentariibac"
        minSdkVersion 9
        targetSdkVersion 24
        versionCode 5
        versionName "1.4"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.google.android.gms:play-services-ads:9.0.0'
    compile 'com.google.firebase:firebase-core:10.0.1'
}
apply plugin: 'com.google.gms.google-services'

The line compile 'com.google.android.gms:play-services-ads:9.0.0' is highlighted with red and is saying that all google.android.gms libraries must use the exact same version specification. I need some help. Thanks in advance!

On Android, Firebase is actually part of Play services. When you build with Firebase, all of the SDK versions must match your Play services SDK versions. As it stands now, you are asking for 9.0.0 of play-services-ads and 10.0.1 of firebase-core. These need to match, and the latest version of the entire set of Play services SDKs is 10.0.1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM