导入Httpclient时出错,httpcore& httpmime

时间:2016-03-28 06:31:28

标签: android android-studio httpclient apache-httpclient-4.x

我在Android Studio中遇到此问题。

image

2 个答案:

答案 0 :(得分:1)

在你的应用的build.gradle文件中添加它

    packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'

}

答案 1 :(得分:1)

由于错误消息表明您没有排除存在于多个依赖项中的META-INF/NOTICE文件

  

com.android.build.api.transform.TransformException:com.android.builder.packaging.DuplicateFileException:在APK META-INF / NOTICE中复制的重复文件

packagingOptions {
    exclude 'META-INF/LICENSE' // will not include NOTICE file 
    exclude 'META-INF/NOTICE' // will not include NOTICE file       
}