DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE

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: /Users/jack/aipqa/sinfo.h5.apk.pref/app/libs/httpclient-4.4.jar
File2: /Users/jack/aipqa/sinfo.h5.apk.pref/app/libs/httpcore-4.4.jar



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/DEPENDENCIES
File1: /Users/jack/aipqa/sinfo.h5.apk.pref/app/libs/httpclient-4.4.jar
File2: /Users/jack/aipqa/sinfo.h5.apk.pref/app/libs/httpcore-4.4.jar

解决方案:

The DSL to exclude files is:

android {
...
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
}
}