2017-03-09 50 views
1

我將一些現有的基於Eclipse的Android項目導入到Android Studio中。一直以來,我的方式修正了幾個問題,我打這最後一個問題(希望):com.android.build.api.transform.TransformException:java.util.zip.ZipException

Execution failed for task ':myapp:transformClassesWithJarMergingForDebug'. 
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/mypackage/myapp/BuildConfig.class 

這裏有依賴關係: 模塊1:

dependencies { 
    provided files('src/main/libs/opencv.jar') 
} 

模塊2:

dependencies { 
    compile files('libs/autobanh.jar') 
    compile files('libs/libjingle_peerconnection_java.jar') 
} 

單詞數:

dependencies { 
    compile 'com.google.code.gson:gson:2.2.1' 
    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile 'com.google.android.gms:play-services:+' 
    compile files('src/main/libs/gcm.jar') 
} 

版Module:

dependencies { 
    compile project(':module3') 
    compile 'com.google.android.gms:play-services:+' 
} 

最後的應用程序:

dependencies { 
    compile project(':module1') 
    compile project(':module2') 
    compile project(':module3') 
    compile project(':module4') 
    compile 'com.android.support:support-v4:23.4.0' 
    compile files('libs/AndroidSwipeLayout-v1.1.8.jar') 
    compile 'com.android.support:appcompat-v7:23.4.0' 
} 

我該如何解決這個問題?到目前爲止,我嘗試了以下內容:

transformClassesWithJarMergingForDebug,com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:

Execution failed for transformClassesWithJarMergingForDebug'. (Volley)

沒有幫助。有什麼想法嗎?

+1

每個模塊中有一個獨特的包名必須在他們的表現不同的軟件包名稱。除最後一個之外的所有模塊都必須是庫。 –

+0

@EugenPechanec你已經發現了重複的包名。我有一個重複的包名稱,並已設置: enforceUniquePackageName = false 更改module4的包名稱後,它已經超過該問題。萬分感謝。請記錄您的評論作爲我接受的答案。 – ssk

回答

1

錯誤說

重複條目:COM/mypackage的/ MyApp的/ BuildConfig.class

BuildConfig是指定根據包名稱爲每個模塊(Android的庫或應用程序)生成的類在其清單中。

確保所有的模塊,其AndroidManifest.xml

相關問題