我正在尝试在我的cordova项目中添加以下依赖项。但是,依赖关系在构建过程中会被忽略。
compile 'org.apache.httpcomponents:httpclient:4.5.2'
从关于类似问题的stackoverflow答案中,我意识到我必须排除几个模块和组。
因此,我对依赖项进行了以下更改。
compile 'org.apache.httpcomponents:httpclient:4.5.2'
compile ('org.apache.httpcomponents:httpclient:4.5.2'){
exclude module: 'httpclient' //by artifact name
exclude group: 'org.apache.httpcomponents' //by group
exclude group: 'org.apache.httpcomponents', module: 'httpclient' //by both name and group
}
但是,我仍然收到此警告。
WARNING: Dependency org.apache.httpcomponents:httpclient:4.5.2 is ignored for debug as it
may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages.
结果,我的所有HTTP命令(如HTTP Post,HTTP Client等)都无法解析。
有人可以建议我到底要排除什么,以及是否需要任何配置更改?
您可以通过添加以下行来使用HTTP库来构建应用程序脚本:
useLibrary 'org.apache.http.legacy'
喜欢:
android {
compileSdkVersion XX
buildToolsVersion "XX.X.X"
useLibrary 'org.apache.http.legacy'
// other lines
}
希望这个帮助:)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句