0

I have a problem when I try to generate an apk with Android Studio 2.3

I'm getting an error:

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/antlr/v4/runtime/ANTLRErrorListener.class

I understand that some of my dependencies must implement the same methods, but I can't figure out which one,

Here are my dependencies

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:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.graphql-java:graphql-java:2016-10-19T14-40-14'
    compile 'junit:junit:4.12'
    compile 'com.google.android.gms:play-services-appindexing:9.8.0'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'org.altbeacon:android-beacon-library:2.12.2'
    compile 'io.fotoapparat.fotoapparat:library:1.4.1'
    testCompile 'junit:junit:4.12'
}

Thank you

ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
  • execute `gradlew app:dependencies --configuration releaseCompileClasspath` and post output here. Also check, that you use `class App extends MultiDexApplication` – DeKaNszn Oct 19 '17 at 11:00
  • 1
    Possible duplicate of [Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'](https://stackoverflow.com/questions/33209631/errorexecution-failed-for-task-apptransformclasseswithjarmergingfordebug) – Vishal Yadav Oct 21 '17 at 07:03

1 Answers1

1

You can exclude the antlr4 in the dependency with:

compile('com.graphql-java:graphql-java:2016-10-19T14-40-14') {
   exclude module: 'antlr4'
}

You can find the related issues here:

  1. https://github.com/graphql-java/graphql-java/issues/225
  2. https://github.com/graphql-java/graphql-java/issues/254
ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
  • 1
    Hi ! Thank you for your answer, It worked but i used configurations { all*.exclude module: 'antlr4' } because other dependencies had antlr4 too and it worked ! – Jérémy Mediavilla Oct 19 '17 at 11:17