今天用上Android Studio2.0正式版,编译项目后出现如下错误:
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForUmengDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.belerweb/pinyin4j/pom.properties
File1: C:\Users\CYM\.gradle\caches\modules-2\files-2.1\com.belerweb\pinyin4j\2.5.0\5a620aedec0f779f2123ba60fd4b74bfbd3e2646\pinyin4j-2.5.0.jar
File2: C:\Users\CYM\.gradle\caches\modules-2\files-2.1\com.belerweb\pinyin4j\2.5.0\5a620aedec0f779f2123ba60fd4b74bfbd3e2646\pinyin4j-2.5.0.jar
在build.grade里的android里添加:
packagingOptions {
exclude 'META-INF/maven/com.belerweb/pinyin4j/pom.xml'
exclude 'META-INF/maven/com.belerweb/pinyin4j/pom.properties'
}
查考: http://unix8.net/home.php/category/android