1

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

Error:FAILURE: Build failed with an exception.
  • What went wrong:

    Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE File1: C:\Users\e171x.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.2.2\d20be6a5ddd6f8cfd36ebf6dea329873a1c41f1b\jackson-core-2.2.2.jar File2: C:\Users\e171x.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.2.2\3c8f6018eaa72d43b261181e801e6f8676c16ef6\jackson-databind-2.2.2.jar File3: C:\Users\e171x.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.2.2\285cb9c666f0f0f3dd8a1be04e1f457eb7b15113\jackson-annotations-2.2.2.jar

  • Try: Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

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'
3

2 Answers 2

2

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'
})
Sign up to request clarification or add additional context in comments.

6 Comments

I edited the post and added build.gradle , Can you check please if I have any duplication ? "
You have only one module in your project?
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.1' classpath 'com.google.gms:google-services:3.0.0' } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir }
Yes and the above is my project gradle
Are you using any JAR files, I mean putting them in lib folder?
|
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.