解决transformResourcesWithMergeJavaResForDebug问题

1:添加了rxjava;以下是报错内容

Error:Execution failed for task ':newworldapp:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/rxjava.properties
File1: C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\io.reactivex\rxjava\1.2.1\4e4cfa4adc74521d5966799fa5ab70b733552f68\rxjava-1.2.1.jar
File2: C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\io.reactivex.rxjava2\rxjava\2.0.2\cfccdd18cdfbe7b4773d42c9f3512eeafbe5cbf9\rxjava-2.0.2.jar



解决办法:在app的build.gradle文件的android下添加

packagingOptions {
    exclude 'META-INF/rxjava.properties'
    // ... and any other excludes go here
}


2:

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/LICENSE
    File1: .gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.2.2\3c8f6018eaa72d43b261181e801e6f8676c16ef6\jackson-databind-2.2.2.jar
    File2: .gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.2.2\d20be6a5ddd6f8cfd36ebf6dea329873a1c41f1b\jackson-core-2.2.2.jar

File3: .gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\

解决办法:

packagingOptions {
    exclude 'META-INF/NOTICE' // will not include NOTICE file
    exclude 'META-INF/LICENSE' // will not include LICENSE file
}
3:

  1. Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForUmengDebug'.  
  2.  > com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.belerweb/pinyin4j/pom.properties   
  3. File1: C:\Users\CYM\.gradle\caches\modules-2\files-2.1\com.belerweb\pinyin4j\2.5.0\5a620aedec0f779f2123ba60fd4b74bfbd3e2646\pinyin4j-2.5.0.jar  
  4. File2: C:\Users\CYM\.gradle\caches\modules-2\files-2.1\com.belerweb\pinyin4j\2.5.0\5a620aedec0f779f2123ba60fd4b74bfbd3e2646\pinyin4j-2.5.0.jar 

解决办法:

  1. packagingOptions {  
  2.     exclude 'META-INF/maven/com.belerweb/pinyin4j/pom.xml'  
  3.     exclude 'META-INF/maven/com.belerweb/pinyin4j/pom.properties'  
  4. } 


参考:http://blog.csdn.net/zhouzme/article/details/18923293

http://blog.csdn.net/small_lee/article/details/51248383

你可能感兴趣的:(解决transformResourcesWithMergeJavaResForDebug问题)