简体   繁体   English

我的android项目依赖项httpclient和httpMime无法建立

[英]my android project dependence the httpclient and httpMime can't build

I'm use the dependencies by 我用的依赖

compile 'org.apache.httpcomponents:httpmime:4.3.5'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'`

then build it there is error Error:Gradle: Execution failed for task ':XmppDemo:packageDebug'. 然后构建它,出现错误Error:Gradle:任务':XmppDemo:packageDebug'的执行失败。

Duplicate files copied in APK META-INF/NOTICE File 1: E:\\develop\\gradle.gradle\\caches\\modules-2\\files-2.1\\org.apache.httpcomponents\\httpclient-android\\4.3.5\\82edcaec6c7b4599eaeaaf11167ceea41db42f33\\httpclient-android-4.3.5.jar File 2: E:\\develop\\gradle.gradle\\caches\\modules-2\\files-2.1\\org.apache.httpcomponents\\httpclient-android\\4.3.5\\82edcaec6c7b4599eaeaaf11167ceea41db42f33\\httpclient-android-4.3.5.jar 在APK META-INF / NOTICE文件1中复制的重复文件:E:\\ develop \\ gradle.gradle \\ caches \\ modules-2 \\ files-2.1 \\ org.apache.httpcomponents \\ httpclient-android \\ 4.3.5 \\ 82edcaec6c7b4599eaeaaf11167ceea41db42f33 \\ httpclient- android-4.3.5.jar文件2:E:\\ develop \\ gradle.gradle \\ caches \\ modules-2 \\ files-2.1 \\ org.apache.httpcomponents \\ httpclient-android \\ 4.3.5 \\ 82edcaec6c7b4599eaeaaf11167ceea41db42f33 \\ httpclient-android-4.3 .5.jar

can you help me explain the reason. 你能帮我解释一下原因吗? excuse me! 劳驾! i'm Chinese,my English is not good. 我是中国人,我的英语不好。

The packager is telling you that the file META-INF/NOTICE appears in more than one jar file (which creates a conflict) and therefore cannot be included. 打包程序告诉您,文件META-INF / NOTICE出现在多个jar文件中(这会产生冲突),因此不能包含在内。 To solve that problem, add this section to your build.gradle (you might already have an android closure, in which case add just the packagingOptions part): 要解决该问题,请将此部分添加到您的build.gradle (您可能已经有一个android闭包,在这种情况下,只需添加packagingOptions部分):

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

Your particular problem is about the NOTICE file but I suspect that you might also run into problems with LICENSE and DEPENDENCIES . 您的特定问题与NOTICE文件有关,但我怀疑您可能还会遇到LICENSEDEPENDENCIES问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM