【问题标题】:what the solution of Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug' 的解决方案是什么
【发布时间】:2018-01-10 20:45:34
【问题描述】:

我已经尝试编译并且没有错误,但是当我想运行应用程序时,我得到了这个错误:

Error:Execution failed for task 
':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: 
java.util.zip.ZipException: duplicate entry: 
com/google/gson/annotations/Expose.class

我的依赖是:

    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 files('src/include/gson-2.8.2-SNAPSHOT.jar')
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:23.2.0'
    compile 'io.searchbox:jest-droid:2.0.1'
    testCompile 'junit:junit:4.12'

【问题讨论】:

    标签: android android-studio compiler-errors duplicates


    【解决方案1】:

    我注意到您的问题与 this 重复

    正如该问题中接受的答案所述,您必须在此处多编译 GSON

    编译文件('src/include/gson-2.8.2-SNAPSHOT.jar')

    在另一个库中...我假设是这个:

    编译'io.searchbox:jest-droid:2.0.1'

    所以我建议为您的项目复制已接受的答案,如下所示:

    compile('io.searchbox:jest-droid:2.0.1') {
    exclude module: 'gson'
    }
    

    【讨论】:

      猜你喜欢
      • 2018-04-02
      • 2022-11-11
      • 1970-01-01
      • 1970-01-01
      • 2013-07-03
      • 2019-03-09
      • 1970-01-01
      • 1970-01-01
      • 2018-11-13
      相关资源
      最近更新 更多