Android app level build.gradle giving Error : httpclient defines classes that conflict with classes now provided by Android

Android app level build.gradle giving Error : httpclient defines classes that conflict with classes now provided by Android

在我的一个旧项目中,我在我的应用级别 build.gradle 文件中得到这个 error/suggestion:

httpclient defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar.

查看下面的屏幕截图:

看来错误是因为依赖org.apache.httpcomponents:httpmime:4.5.12

我试图通过互联网找到解决方案。已尝试 , 2 , 3 但无济于事。

如有任何帮助,我们将不胜感激。

我通过添加 implementation "org.apache.httpcomponents:httpcore:4.4.13" 并排除 group: 'org.apache.httpcomponents', module: 'httpclient'

解决了它

检查这个:

implementation('org.apache.httpcomponents:httpmime:4.5.12') {
    exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
implementation "org.apache.httpcomponents:httpcore:4.4.13"