Dependency ignored because of conflict Android studio

你说的曾经没有我的故事 提交于 2019-12-17 07:21:47

问题


I'm trying to add the following dependency but it is ignore. I can't understand how to resolve it please help me Thank you.

Dependency

 compile 'com.google.apis:google-api-services-drive:v2-rev170-1.20.0'

Waring for ignoring dependency
Warning:Dependency org.apache.httpcomponents:httpclient:4.0.1 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 Warning:Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release 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


回答1:


You can exclude dependencies in the build.gradle file of your module.

compile('com.google.apis:google-api-services-drive:v2-rev170-1.20.0') {
    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
}



回答2:


Exclude module httpclient from all configurations. Add this code in the build.gradle file:

configurations {
    compile.exclude group: "org.apache.httpcomponents", module: "httpclient"
}



回答3:


Use the following code to exclude the conflicting modules from the google APIs library.

 compile 'com.google.apis:google-api-services-drive:v2-rev170-1.20.0' {
    exclude module: 'httpcore'
    exclude module: 'httpclient'
}


来源:https://stackoverflow.com/questions/30460148/dependency-ignored-because-of-conflict-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!