2017-05-09 69 views
0

我面臨的問題,同時建立了APK ..問題關於重複Android的支持,v4.jar

錯誤:執行失敗的任務「:應用程序:transformClassesWithJarMergingForDebug」。

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/widget/ViewDragHelper$Callback.class

我已經添加的依賴關係是:

compile fileTree(include: ['*.jar'], dir: 'libs') 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile files('libs/PGSDK_v1.0.1.jar') 
    compile files('libs/gcm.jar') 
    compile files('libs/utilities.jar') 
    compile files('libs/volley.jar') 
    compile 'com.google.code.gson:gson:2.2.4' 
    compile 'com.moengage:moe-android-sdk:7.4.01' 
    compile 'com.google.android.gms:play-services-gcm:10.0.1' 
    compile 'com.android.support:appcompat-v7:25.3.1' 
    compile 'com.android.support:design:25.3.1' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    testCompile 'junit:junit:4.12' 

回答

1

刪除此依賴compile files('libs/gcm.jar')

你已經有compile 'com.google.android.gms:play-services-gcm:10.0.1'

編輯

內部小號ome庫取決於使用x-version的support-v4,以便將gradle鏈接到您的項目中。檢查哪個工件具有support-v4,並手動從該工件中排除support-v4

compile ('com.android.support:appcompat-v7:25.3.1') { 
    exclude module: 'support-v4' 
} 

如果artifact在任何存儲庫中都可用,最好使用工件名和版本的組名來編譯而不是jar。

+0

我刪除了它,但仍然錯誤是爲「android/support/v4/widget/ViewDragHelper $ Callback.class」 – Deep

+0

清理項目並刷新依賴項 – Aryan

+1

您必須刪除jar文件,因爲您正在使用compile fileTree包括:['* .jar'],dir:'libs') –

相關問題