Firebase Android在依赖项

时间:2016-12-29 07:29:01

标签: android android-studio firebase firebase-realtime-database

我尝试使用Firebase创建实时数据库。我遵循了原则,但却出现了错误。

我的build.gradle应用程序如下:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.3"
    defaultConfig {
        applicationId "com.example.ashik.project"
        minSdkVersion 17
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }


    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:multidex:1.0.1'
    compile "com.squareup.picasso:picasso:2.4.0"

    compile 'com.google.firebase:firebase-core:9.0.2'
    compile 'com.google.firebase:firebase-database:9.0.2'
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:support-v4:24.0.0'
    compile 'com.android.support:design:24.0.0'
    compile 'com.firebase:firebase-client-android:2.5.2+'
    compile 'com.firebaseui:firebase-ui:0.3.1'
    compile 'com.github.dakatso:livebutton:1.0.0'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.squareup.picasso:picasso:2.4.0'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.balysv:material-ripple:1.0.2'
    compile 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.android.gms:play-services:9.0.2'
    compile 'com.google.android.gms:play-services-ads:9.0.2'
    compile 'com.google.android.gms:play-services-auth:9.0.2'
    compile 'com.google.android.gms:play-services-gcm:9.0.2'
    compile 'org.jsoup:jsoup:1.10.1'
    compile 'com.facebook.stetho:stetho-okhttp:1.4.1'
    androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
}
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 {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.1'

        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
}

在控制台中显示错误:

Error:FAILURE: Build failed with an exception.

我该如何解决这个请帮助......

2 个答案:

答案 0 :(得分:0)

替换

compile 'com.firebase:firebase-client-android:2.5.2+'

compile 'com.firebase:firebase-client-android:2.3.1'

compile 'com.firebase:firebase-client-android:2.4.0'

答案 1 :(得分:0)

看起来你有一半使用Firebase 2.x(com.firebase ...),有一半使用Firebase 3.x(com.google.firebase ...

也许这两个是冲突的并导致错误?

https://firebase.google.com/support/guides/firebase-android可以帮助您切换。