在模块中找到重复的类org.apache.http.HttpHeaders

时间:2019-08-23 10:23:06

标签: java android android-studio

将我的android studio更新到3.5版本后,由于找到重复的类而出现错误。 下面是发现的错误。

  

在模块中发现重复的类org.apache.http.Consts   httpclient-android-4.3.5.1.jar   (org.apache.httpcomponents:httpclient-android:4.3.5.1)和   httpcore-4.3.2.jar(org.apache.httpcomponents:httpcore:4.3.2)   在以下位置找到重复的类org.apache.http.ContentTooLongException   模块httpclient-android-4.3.5.1.jar   (org.apache.httpcomponents:httpclient-android:4.3.5.1)和   httpcore-4.3.2.jar(org.apache.httpcomponents:httpcore:4.3.2)   在模块中找到重复的类org.apache.http.HttpConnectionFactory   httpclient-android-4.3.5.1.jar   (org.apache.httpcomponents:httpclient-android:4.3.5.1)和   httpcore-4.3.2.jar(org.apache.httpcomponents:httpcore:4.3.2)   在模块中找到重复的类org.apache.http.HttpHeaders   httpclient-android-4.3.5.1.jar   (org.apache.httpcomponents:httpclient-android:4.3.5.1)和   httpcore-4.3.2.jar(org.apache.httpcomponents:httpcore:4.3.2)   在以下位置找到重复的类org.apache.http.MessageConstraintException   模块httpclient-android-4.3.5.1.jar   (org.apache.httpcomponents:httpclient-android:4.3.5.1)和   httpcore-4.3.2.jar(org.apache.httpcomponents:httpcore:4.3.2)   在以下位置找到重复的类org.apache.http.TruncatedChunkException   模块httpclient-android-4.3.5.1.jar   (org.apache.httpcomponents:httpclient-android:4.3.5.1)和   httpcore-4.3.2.jar(org.apache.httpcomponents:httpcore:4.3.2)   在模块中找到重复的类org.apache.http.annotation.GuardedBy   httpclient-android-4.3.5.1.jar   (org.apache.httpcomponents:httpclient-android:4.3.5.1)和   httpcore-4.3.2.jar(org.apache.httpcomponents:httpcore:4.3.2)   在模块中找到重复的类org.apache.http.annotation.Immutable   httpclient-android-4.3.5.1.jar   (org.apache.httpcomponents:httpclient-android:4.3.5.1)和   httpcore-4.3.2.jar(org.apache.httpcomponents:httpcore:4.3.2)

2 个答案:

答案 0 :(得分:0)

通过在gradle文件中从实现的库中排除重复项来解决:

implementation ('org.apache.httpcomponents:httpclient-android:4.3.5.1') {
    exclude group: 'org.apache.http'
}

implementation ('org.apache.httpcomponents:httpcore:4.3.2') {
    exclude group: 'org.apache.http'
}

如果您需要更多帮助,请完整发布gradle文件。

答案 1 :(得分:-1)

您有几个相同的库,并删除了相似的库