whoseee
whoseee

Reputation: 31

error while using firebase

When i'm using Firebase I always face this error !

Error:FAILURE: Build failed with an exception.

which doesn't allow the emulator to run

my app gradle

   apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"
    defaultConfig {
        applicationId "com.example.e171x.testingonline"
        minSdkVersion 15
        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'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })



    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.google.firebase:firebase-crash:9.8.0'
    compile 'com.google.firebase:firebase-database:9.8.0'
    compile 'com.google.firebase:firebase-auth:9.8.0'
    compile 'com.firebase:firebase-client-android:2.3.1'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

Upvotes: 1

Views: 462

Answers (2)

Bob Snyder
Bob Snyder

Reputation: 38289

You should not use both the legacy Firebase SDK, com.firebase:firebase-client-android:2.3.1, and the libraries of the new 9.x.x SDK in the same app. They are not compatible and will interfere with each other. Remove com.firebase:firebase-client-android:2.3.1 and read the Firebase Upgrade Guide for tips on code changes.

Upvotes: 1

Kamran Ahmed
Kamran Ahmed

Reputation: 7761

It looks like you are adding one of the JARs, namely jackson-core-2.2.2.jar from multiple modules. If you are using Android Studio, check in build.gradle files of each of your modules to check where the duplication is. You may keep it where it is accessible from all modules based on your dependency chain.

Replace:

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

with:

compile('com.firebase:firebase-client-android:2.3.1', {
    exclude group: 'com.fasterxml.jackson.core', module: 'jackson-bind'
    exclude group: 'com.fasterxml.jackson.core', module: 'jackson-annotations'
    exclude group: 'com.fasterxml.jackson.core', module: 'jackson-core'
})

Upvotes: 2

Related Questions