Android Studio 错误 Duplicate files copied in APK META-INF/LICENSE.txt解决方案

<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;"><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">android </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">{</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">

    packagingOptions </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">{</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">
    exclude </span><span class="str" style="margin: 0px; padding: 0px; border: 0px; color: rgb(128, 0, 0);">'META-INF/LICENSE.txt'</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">
    </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">}</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">
</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">}</span></code>

My logcat: log Execution failed for task ':Prog:packageDebug'.

Duplicate files copied in APK META-INF/LICENSE.txt File 1: /home/scijoker/AndroidStudioProjects/ProgProject/Prog/libs/httpclient-4.1.1.jar File 2: /home/scijoker/AndroidStudioProjects/ProgProject/Prog/libs/httpclient-4.1.1.jar

 解决方法:
[java]  view plain  copy
  1. android {  
  2.       
  3.   
  4.     packagingOptions {  
  5.         exclude 'META-INF/DEPENDENCIES.txt'  
  6.         exclude 'META-INF/LICENSE.txt'  
  7.         exclude 'META-INF/NOTICE.txt'  
  8.         exclude 'META-INF/NOTICE'  
  9.         exclude 'META-INF/LICENSE'  
  10.         exclude 'META-INF/DEPENDENCIES'  
  11.         exclude 'META-INF/notice.txt'  
  12.         exclude 'META-INF/license.txt'  
  13.         exclude 'META-INF/dependencies.txt'  
  14.         exclude 'META-INF/LGPL2.1'  
  15.     }  
  16. }  


赞一下 :
Android Studio大课堂 - 1.简要介绍  
Android Studio大课堂 - 2.下载安装及初始化  
Android Studio大课堂 - 3.新建或导入APP  
Android Studio大课堂 - 4.1.Coding - 定位目标  
Android Studio大课堂 - 4.2.Coding - 写代码  
Android Studio大课堂 - 4.3.Coding - 使用第三方库  
Android Studio大课堂 - 4.4.Coding - 快捷键  
Android Studio大课堂 - 5.编译&运行&调试&优化  
Android Studio大课堂 - 6.1.打包 - 详解build.gradle  
Android Studio大课堂 - 6.2.打包 - 友盟多渠道包示例  
Android Studio大课堂 - 7.1扩展功能 - 截屏或录制视频  
Android Studio大课堂 - 7.2扩展功能 - 快速导入谷歌官方提供的Sample APP  
Android Studio大课堂 - 8.不改变现有目录结构开发Eclipse项目

你可能感兴趣的:(Android Studio 错误 Duplicate files copied in APK META-INF/LICENSE.txt解决方案)