build.gradle-Error:duplicate files during packagin

只需要在Android下的build.gradle加上这个。
packagingOptions {
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
}
     当报这样的错的时候   
    Error:duplicate files during packaging of APK E:\studiospace\CheGuan\app\build\outputs\apk\app-debug-unaligned.apk
    Path in archive: META-INF/LICENSE.txt
    Origin 1: E:\studiospace\CheGuan\app\libs\httpcore-4.2.4.jar
    Origin 2: E:\studiospace\CheGuan\app\libs\fastjson-1.2.5.jar
You can ignore those files in your build.gradle:
    android {
      packagingOptions {
        exclude 'META-INF/LICENSE.txt'
      }
    }
Error:Execution failed for task ':app:packageDebug'.
> Duplicate files copied in APK META-INF/LICENSE.txt
    File 1: E:\studiospace\CheGuan\app\libs\httpcore-4.2.4.jar
    File 2: E:\studiospace\CheGuan\app\libs\fastjson-1.2.5.jar

你可能感兴趣的:(build.gradle-Error:duplicate files during packagin)