Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.

Android studio 在编译时遇到以下错误

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/services/com.fasterxml.jackson.core.ObjectCodec

//上面这句是重点
File1: D:\asCode\********\build\intermediates\exploded-aar\*****\jars\classes.jar
File2: D:\asCode\********\build\intermediates\exploded-aar\******\unspecified\jars\classes.jar


部分路径与项目相关,采用了*号代替,这类错误的解决办法是


引起错误的原因是将jar包打包进apk文件的时候产生了冲突


在module的build.gradle加入如下代码


 
  
android {
    packagingOptions {
//        exclude 'META-INF/NOTICE'
        exclude 'META-INF/services/com.fasterxml.jackson.core.ObjectCodec'
    }
}

你可能感兴趣的:(bug,解决方案,Android,解决方案,android,studio)