Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Duplicate files copied in APK META-INF/BCKEY.DSA

My code builds fine, but when I try to run it in debug, I get the following error:

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
    com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/BCKEY.DSA
        File1: D:\Android\AndroidStudio\gradle\m2repository\org\bouncycastle\bcpkix-jdk15on\1.48\bcpkix-jdk15on-1.48.jar
        File2: C:\Users\beili\.gradle\caches\modules-2\files-2.1\org.bouncycastle\bcprov-jdk15on\1.48\960dea7c9181ba0b17e8bab0c06a43f0a5f04e65\bcprov-jdk15on-1.48.jar

How can I resolve this?

like image 606
bin ding Avatar asked Mar 04 '16 03:03

bin ding


1 Answers

Add this to your build.gradle inside the android section like

android{
    packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/BCKEY.DSA'
    exclude 'AUTHORS'
    }
}
like image 156
Eury Pérez Beltré Avatar answered Nov 09 '22 20:11

Eury Pérez Beltré