http://blog.csdn.net/janronehoo/article/details/47973753 


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

  13629人阅读  评论(9)  收藏  举报
  分类:
 

 1 .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
  在CODE上查看代码片 派生到我的代码片
  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. }  





http://blog.csdn.net/u011904605/article/details/52145078
http://blog.csdn.net/u011904605/article/details/52145078

 

Android Duplicate files copied in APK

标签: androidDuplicate filesandroid studio
  9854人阅读  评论(0)  收藏  举报
  分类:

今天调试 Android 应用遇到这么个问题:

Duplicate files copied in APK META-INF/DEPENDENCIES File 1: httpmime-4.3.2.jar File 2: httpmime-4.3.2.jar

貌似说两个包里面的文件重复了还是怎么的,谷歌了一番之后据说应该是 android studio 自身的bug

解决办法:

打开项目下面的 build.gradle 文件,在 android 代码块中添加下面代码

[sql]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. android {  
  2.     packagingOptions {  
  3.         exclude 'META-INF/DEPENDENCIES'  
  4.         exclude 'META-INF/NOTICE'  
  5.         exclude 'META-INF/LICENSE'  
  6.         exclude 'META-INF/LICENSE.txt'  
  7.         exclude 'META-INF/NOTICE.txt'  
  8.     }  
  9. }  

将这些文件全部排出掉就ok了

但不知道这么做会不会有什么隐患,还是有其他更好的解决办法

可以参考下这篇文章:http://stackoverflow.com/questions/20853094/gradle-and-android-studio-duplicate-file-copied-from-same-jar


Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐