【问题标题】:Error while importing Httpclient, httpcore & httpmime [closed]导入 Httpclient、httpcore 和 httpmime 时出错 [关闭]
【发布时间】:2016-03-28 06:31:28
【问题描述】:

我在 Android Studio 中遇到了这个问题。

【问题讨论】:

  • httpclient 已弃用。你应该改用 httpurlconnection

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


【解决方案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'

}

【讨论】:

    【解决方案2】:

    正如错误消息所示,您并未排除存在于多个依赖项中的 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       
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-15
      • 1970-01-01
      • 2015-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-08
      相关资源
      最近更新 更多