2017-08-03 23 views
0

遇到以下问题:** FAILURE:构建失败,出现异常。构建签名时APK:app:transformClassesWithJarMergingForRelease

  • 出错: 任务':app:transformClassesWithJarMergingForRelease'的执行失败。

    com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复的条目:COM /谷歌/ GSON /注释/ Expose.class **

这是我尝试使用发布已签名的APK进行构建时的情况。然而,当我只是在Gradle中进行调试或同步时,它才起作用。

我认为在版本控制支持或编译依赖问题上存在问题。我只是不确定什么是正确的方法来追踪问题。

我试过清理然后重建。 Debug Build没有问题,但是在签名APK上我遇到了这个问题。

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    // Single target that includes all FirebaseUI libraries above 
    compile files('libs/YouTubeAndroidPlayerApi.jar') 
    compile files('libs/plivo-java-3.0.9-jar-with-dependencies.jar') 
    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile 'com.android.support:design:23.4.0' 
    compile 'com.squareup.picasso:picasso:2.5.2' 
    compile 'com.google.firebase:firebase-core:10.0.1' 
    compile 'com.google.firebase:firebase-database:10.0.1' 
    compile 'com.google.firebase:firebase-storage:10.0.1' 
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4' 
    compile 'com.android.support:support-v4:23.4.0' 
    compile 'com.android.support:support-vector-drawable:23.4.0' 
    compile 'com.google.firebase:firebase-messaging:10.0.1' 
    compile 'com.firebaseui:firebase-ui:1.0.1' 
    compile 'com.android.support:recyclerview-v7:23.4.0' 
    testCompile 'junit:junit:4.12' 
    compile project(':DailymotionWebSDK') 
} 

apply plugin: 'com.google.gms.google-services' 

回答

0

这是因为以下两个库都包括在其内部GSON依赖性:

compile files('libs/plivo-java-3.0.9-jar-with-dependencies.jar') 
compile project(':DailymotionWebSDK') 

对于plivo-Java SDK中,看它的pom.xml

对于DailyMotionWebSDK,看它的build.gradle

所以,你需要从其中之一中排除gson。

+0

有没有可能的方法呢?有些人说,如果你有一个.jar文件,就不可能排除它。我尝试了排除功能,但它不起作用。 – Aizen

+1

请尝试使用包含plivo-java-3.0.9.jar而不是plivo-java-3.0.9-jar -with-dependencies.jar,如其README所述“如果您的项目中存在冲突瓶子问题,请使用此选项。请参阅pom.xml获取您需要包含的依赖关系列表。https://github.com/plivo/plivo-java –