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

My code builds fine, but when I try to run it when debugging, 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 solve this?

+5
source share
1 answer

Add this to your build.gradle inside the Android section, e.g.

 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' } } 
+7
source

Source: https://habr.com/ru/post/1244399/


All Articles